When I add the product twice, it keep displaying in a new line, with new quantity. I want the quantity to update. what I’m doing wrong? here’s the code:
[code]
<?
include “functions.php”;
if(!$_SESSION[‘logged’]){die();}
$_POST[‘taxes’]=str_replace(‘undefined,’,”,$_POST[‘taxes’]);
if(empty($_SESSION[‘products’]))$_SESSION[‘products’]=array();
if($_POST[‘action’]==’add’){
$_POST[$qty]=str_replace(‘,’,’.’,$_POST[$qty]);
$_SESSION[‘products’][]=$_POST;
}
if($_POST[‘action’]==’delete’){
unset($_SESSION[‘products’][$_POST[‘id’]]);
}
if($_POST[‘action’]==’update’){
if($_POST[‘rule’]==0)$_SESSION[‘products’][$_POST[‘id’]][‘qty’]-=1;
if($_POST[‘rule’]==1)$_SESSION[‘products’][$_POST[‘id’]][‘qty’]+=1;
}
?>
thanks.