Disappearing Session Variables
Posted: Thu Jun 10, 2004 11:53 am
Just wondering could someone help?
After the user submits an order form they can view what they ordered, so they get shown the items with the quantity.
however, when they go to but a second item and go back to view their orders, all thats shown is the 2nd item with the quantity, but the previous orders without their quantities.
If someone could help me out on this I would be eternally grateful...
here is the code I'm using:
After the user submits an order form they can view what they ordered, so they get shown the items with the quantity.
however, when they go to but a second item and go back to view their orders, all thats shown is the 2nd item with the quantity, but the previous orders without their quantities.
If someone could help me out on this I would be eternally grateful...
here is the code I'm using:
Code: Select all
<?
session_start();
header("Cache-control: private");
?>
<?
foreach($_POST as $key => $val)
{
$_SESSION[$key] = $val;
}
?>
<?
if(!empty($_SESSION))
{
echo '<p>Detail:<br />';
foreach($_SESSION as $key => $val)
{
if(!empty($val))
{
if(preg_match('|_q$|',$key)) echo 'Quantity: '.$val.'<br />';
elseif(preg_match('||',$key)) echo 'Item: '.$val.'<br />';
}
}
echo '</p>';
}
?>