if i submit the form and than hit reload it adds that amount to the cart again.
e.g. if i add 3 of an item to the cart, then hit reload it will add another 3, if i hit reload again, another 3 etc.
any advice for how to fix this?
thanks a lot.
e.g. if i add 3 of an item to the cart, then hit reload it will add another 3, if i hit reload again, another 3 etc.
any advice for how to fix this?
thanks a lot.
PHP:
<?php
if (isset ($_POST['submitted'])){
$add= (int) $_POST['quantity'];
if ($add > 0){//good to go
if (isset($_SESSION[cart][$pid])){//item in cart, adding more.
$_SESSION[cart][$pid]['quantity']+=$add;
}else{//item not in cart yet
$_SESSION[cart][$pid] = array ('quantity' => "$add", 'price' => "$prize[price]");
}
echo "$add tickets for this prize added to your cart";
}//end of if $add >0
else{
echo ('Please enter the number of tickets you would like to purchase');
}
}//end of if submitted
?>








