【发布时间】:2016-01-06 22:24:40
【问题描述】:
我正在尝试获取下面显示的 html 表单数组的值并使用 php 显示。但是我的代码似乎有问题。
请帮忙。
html 数组
<textarea rows="1" maxlenth = "20" class="round" id="quantityid[]" name="quantityname[]"><?php echo $itemsale["quantity"]; ?></textarea>
<td align="center"><?php echo '<span class="remove-itm"><a href="add_sales.php?saveep='.$itemsale["productname"].'&return_url='.'add_sales.php'.'"><img src="images/saveicon.png" width="30" height="30" /></a></span>'; ?></td>
<textarea rows="1" maxlenth = "20" class="round" id="quantityid[]" name="quantityname[]"><?php echo $itemsale["quantity"]; ?></textarea>
<td align="center"><?php echo '<span class="remove-itm"><a href="add_sales.php?saveep='.$itemsale["productname"].'&return_url='.'add_sales.php'.'"><img src="images/saveicon.png" width="30" height="30" /></a></span>'; ?></td>
<textarea rows="1" maxlenth = "20" class="round" id="quantityid[]" name="quantityname[]"><?php echo $itemsale["quantity"]; ?></textarea>
<td align="center"><?php echo '<span class="remove-itm"><a href="add_sales.php?saveep='.$itemsale["productname"].'&return_url='.'add_sales.php'.'"><img src="images/saveicon.png" width="30" height="30" /></a></span>'; ?></td>
我的 php 代码
if(isset($_GET["saveep"]) && isset($_GET["return_url"]) && isset($_SESSION["cart_sales"]))
{
$product_code = $_GET["saveep"]; //get the product code to remove
$return_url = base64_decode($_GET["return_url"]); //get return url
foreach( $_POST['quantityname'] as $v ) {
echo $v;
}
}
【问题讨论】:
-
问题是"headers already sent" 吗?
-
no 不做任何事情,只是重新加载
-
您在期待什么,表单是否具有
action属性,或者您认为header调用实际上会在您回显输出后重定向? -
是的,表单有@adeneo操作
-
并且方法设置为
POST
标签: javascript php html arrays session