0){ remove_product($_REQUEST['pid']); } else if($_REQUEST['command']=='clear'){ unset($_SESSION['cart']); } else if($_REQUEST['command']=='update'){ $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['PRODUCT_ID']; $q=intval($_REQUEST['product'.$pid]); $result=mysql_query("select * from product where product_id='$pid'"); $row=mysql_fetch_array($result); $item = $row['stock']; if(($q>0 && $q<=999)&&($q<=$item)){ $_SESSION['cart'][$i]['qty']=$q; } else{ $msg='PFFFT!!'; } } } else if($_REQUEST['command']=='place'){ if(!isset($_SESSION['username'])) { ?> '; } else{ $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['PRODUCT_ID']; $q=intval($_REQUEST['product'.$pid]); $result=mysql_query("select * from product where product_id='$pid'"); $row=mysql_fetch_array($result); $item = $row['stock']; if(($q>0 && $q<=999)&&($q<=$item)){ header('location:choose_ship.php'); } else{ $msg='Some products are not updated!The Number of products must be a number between 1 and 999 or the number of products you want is greater than the stock of the product'; } } } } ?>