Removing variables from an order form?


#1

Hi,

Please could someone help me with this problem. I have an order form set up where when someone orders something its details and quantity get sent to the checkout page in session variables. These are of course looped for each product ordered so you get the list of things ordered. However, I can’t seem to be able to remove products. I have renamed the session variable to a normal variable called $pspackdetails. How do I set this $pspackdetails variable to nothing for each indivdiual product to remove that order without removing all the orders.

Any help would be a livesaver…

My code is below:

<? foreach($_POST as $key => $val) { if(!empty($val)) { $_SESSION[$key] = $val; } } ?>
      <?

if(!empty($_SESSION))
{
echo ‘

Here are the items currently in your cart. You may currently change the quantity (soon to be added is the removal of items, e-mailing orders to PS Packaging, and adding up totals).

Code:Type:Size:Rolls:Rates(€):Quantity:
’;
foreach($SESSION as $key => $val)
{
$pspackdetails = ereg_replace("
", “”, $val);
$pspackdetails = ereg_replace("-x-", “
”, $pspackdetails);
$pspackdetails = ereg_replace("–y--", “
”, $pspackdetails);
if($val != “Submit”) { if($val != “Add To Cart”) { if($val != “keane”) { if($val != “ian”) {
if(!empty($val))
{
if(preg_match(’|_q$|’,$key))

{ echo ‘
’; }

elseif(preg_match(’||’,$key)) echo ‘’.$pspackdetails.’’;
}
}
} } } }
echo ‘

Back to Shopping

’;
}
?>

#2

to remove a session variable check onto unset().