【发布时间】:2016-05-30 07:53:50
【问题描述】:
我尝试使用 url 和 GET 将循环变量发送到另一个页面。但 $_GET 只打印最后一个值。
这是我现在的代码
...
//example
$codereg[0] = 6;
$codereg[1] = 2;
$codereg[2] = 67;
if ($option =='sent')
{
foreach($codereg as $ids)
{
header("location:checkout.php?id=$userId&productIds[]=$ids");
}
}
这是我的 checkout.php
<?php
$userId= $_GET['id'];
$code= $_GET['productIds'];
foreach($code as $test)
{
echo $test;
}
?>
有人帮我修复我的代码或提供更好的解决方案...
【问题讨论】:
-
不使用标题...,使用链接点击去更好。