Hi, I have a question about my shopping cart. The cart and session variable are stored in mysql database. I have the following code structure: //basically no html in these include files. Purely GET -POST stuff //and mysql queries //etc. if(isset($_POST['add'])){ include('addtocart.php'); include('viewcart.php'); } elseif(isset($_POST['update'])){ include('updatecart.php'); include('viewcart.php'); } elseif(isset($_GET['pid'])){//delete item $pid=$_GET['pid']; include('deletecart.php'); include('viewcart.php'); } else{ include('viewcart.php'); } . . . //html and cart content is displayed... PHP: My question is: Whenever I refresh the page whilst there are items in the cart, the quantity gets doubled. How can I prevent that? (I believe the code directly executes the following part: if(isset($_POST['add'])){ include('addtocart.php'); include('viewcart.php'); } PHP:
after adding an item to the cart, redirect the user the the page you want... in order to loose the post data