edwardsbc wrote:If you just need to pass the entire $GET array brought into a page on to the next page via hidden fields, try this:
foreach($_GET as $k=>$v) {
echo '<input type="hidden" name="'.$k.'" value="'.$v.'">';
}
I am trying to pass an array through a couple pages. I do not want to use session vars.
Here is my original code receiving $_GET[] from form(this works great):
if (isset($GET['att']))
{
$countatt=count($att);
if($countatt>1)$c=attachments;
else $c=attachment;
echo "You have chosen $countatt $c.<br>";
foreach ($GET['att'] as $att=>$attid[])
{
//echo "Key: $att<br>Attachment ID Value: $attid<br>";
}
foreach($attid as $key=>$val[])
{
//echo "The key is: $key <br>The val is: $val<br>";
}
foreach($val as $keyv=>$valv)
{
$anum_id_price=explode(",","$valv");
list($aid[],$anum[],$aprice[],$amod[])=$anum_id_price;
//echo "The prices are: $aprice<br>";
}
//echo "Attach 1 is: $aid[0]<br>";
while($a=each($anum) AND $b=each($aprice) AND $m=each($amod))
{
$num=$a['value'];
$price=$b['value'];
$mod=$m['value'];
echo "The $mod (attachment order number-$num) price is: \$$price. <br>";
}
Here is my code to pass this to the next page:
echo "<tr><td colspan=6>
<input type=hidden name=total value=$total>
<input type=hidden name=attsubtotal value=$attsubtotal>
<input type=hidden name=att value=".$attid.">
<input type=hidden name=step value=5>
<input type=submit name=submit value=Select></td></tr></form>";
Here is the appropriate text from the URL of the next Page:
&att=Array
When I try to process this array I get this error:
Warning: Invalid argument supplied for foreach() in C:\apache2\htdocs\on line 472
Do I need to use different syntax in the form for passing the GET array?