jay_bo Posted February 17, 2010 Share Posted February 17, 2010 hey, My Shopping cart removes the product that i don't want but i can't seem to update the price. The code below is to delete a product if (isset($_GET['id'], $_GET["delete"]) && is_numeric($_GET['id']) && $_GET['delete'] =="true")//This line gets the value and reads it { $prod_id = (int) $_GET['id']; unset($_SESSION["product"][$prod_id]); header ('Location: products.php?cat=1'); } And this code below is how to display the products foreach($_SESSION['product'] as $prod_id => $prod) { if ($prod["qty"]!=0) { echo 'Quantity: '.$prod["qty"].' - '.$prod["title"].' - £'.($prod["qty"]*$prod["price"]).'<a href="shopping-cart.php?id='.$prod_id.'&delete=true">Remove</a>'.'<br/>'; } } echo'<br /><br />'; $vat= $_SESSION['cost']/1.175; $vat_total = $_SESSION['cost']-$vat; $cost = number_format($vat_total,2,".",","); //Stores data into the variable echo '<span style="color:#F00;"><b>Exc Vat : </b></span>£'.$cost; echo'<br />'; echo '<b>Inc Vat : </b>£'.$_SESSION['cost']; Thanks very much Link to comment https://forums.phpfreaks.com/topic/192352-shopping-cart/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.