Php 如何将选定的文本值从数组会话获取到另一个页面

Php 如何将选定的文本值从数组会话获取到另一个页面,php,html,Php,Html,这是cart.php: foreach($_SESSION['cart'] as $k) { <form class ="align-left"name="form1" method="post" action="cartqty.php"> <tr> <td><p><?php $k['products_title']; ?></p></td> <td

这是cart.php:

   foreach($_SESSION['cart'] as $k) {   

    <form class ="align-left"name="form1" method="post" action="cartqty.php">
      <tr>
      <td><p><?php $k['products_title']; ?></p></td>
      <td><input type="text" name="product_qty[]" value=""/></td>
      <td><input type="hidden" name="product_code" value="<?php $k['products_id']; ?>"/>   </td>
      <td><?php echo number_format($k['price'],2); ?></td>
        </tr>
       <?php
     <input type="submit" name="submit" value="update">                 
    }
    ?>
    </table>
    </form>
如何获取输入文本数量的select值以便我可以相应地更新会话值,我总是获取product_qty数组的最后一个值。
请帮忙

您需要关闭foreach块内的表单标记,如:

foreach($_SESSION['cart'] as $k) {   

<form class ="align-left"name="form1" method="post" action="cartqty.php">
  <tr>
  <td><p><?php $k['products_title']; ?></p></td>
  <td><input type="text" name="product_qty[]" value=""/></td>
  <td><input type="hidden" name="product_code" value="<?php $k['products_id']; ?>"/>   </td>
  <td><?php echo number_format($k['price'],2); ?></td>
    </tr>
   <?php
 <input type="submit" name="submit" value="update">                 
 </form>
}
?>
</table>
foreach($\u会话['cart']作为$k){

“输入文本数量”在哪里\
foreach($_SESSION['cart'] as $k) {   

<form class ="align-left"name="form1" method="post" action="cartqty.php">
  <tr>
  <td><p><?php $k['products_title']; ?></p></td>
  <td><input type="text" name="product_qty[]" value=""/></td>
  <td><input type="hidden" name="product_code" value="<?php $k['products_id']; ?>"/>   </td>
  <td><?php echo number_format($k['price'],2); ?></td>
    </tr>
   <?php
 <input type="submit" name="submit" value="update">                 
 </form>
}
?>
</table>