session_start(); //$cartctr=count($_SESSION['cart']['itemname']); //echo "Cart Ctr=".$cartctr; $delid=-1; if (isset($_GET['delid'])) { $delid=$_GET['delid']; } if ($delid>=0) { //unset = DELETE unset($_SESSION['cart']['itemtype'][$delid]); unset($_SESSION['cart']['itemname'][$delid]); unset($_SESSION['cart']['amount'][$delid]); unset($_SESSION['cart']['quantity'][$delid]); unset($_SESSION['cart']['path'][$delid]); unset($_SESSION['cart']['size'][$delid]); //Aray RESET $_SESSION['cart']['itemtype'] = array_values($_SESSION['cart']['itemtype']); $_SESSION['cart']['itemname'] = array_values($_SESSION['cart']['itemname']); $_SESSION['cart']['amount'] = array_values($_SESSION['cart']['amount']); $_SESSION['cart']['quantity'] = array_values($_SESSION['cart']['quantity']); $_SESSION['cart']['path'] = array_values($_SESSION['cart']['path']); $_SESSION['cart']['size'] = array_values($_SESSION['cart']['size']); } //id = which product, quantity $id=isset($_GET['id']) ? $_GET['id'] : 0; $quantity=isset($_GET['quantity']) ? $_GET['quantity'] : 0; if ($id>=1) { //UPDATE Quantity $_SESSION['cart']['quantity'][$id-1] = $quantity; } ?>
|