else if($_REQUEST['command']=='clear') { unset($_SESSION['cart']); } <script language="javascript"> function del(pid){ if(confirm('Do you really mean to delete this item')){ document.frm1.pid.value=pid; document.frm1.command.value='delete'; document.frm1.submit(); } } function clear_cart(){ if(confirm('This will empty your shopping cart, continue?')){ document.frm1.command.value='clear'; document.frm1.submit(); } } function update_cart(){ document.frm1.command.value='update'; document.frm1.submit(); } </script> function addtocart($pid,$q,$psize,$color){ if($pid<1 or $q<1) return; if(is_array($_SESSION['cart'])){ if(product_exists($pid)) return; $max=count($_SESSION['cart']); $_SESSION['cart'][$max]['productid']=$pid; $_SESSION['cart'][$max]['qty']=$q; ...