I'm busy with my shopping cart but i can't get past this problem. Whenever a user clicks on home, the session that holds products is not destroyed. It should be destroyed because there is an option that a user wants to order something by another business. How can i achieve this?
This creates a $SESSION['cart'].
if(isset($_GET['add'])) {
$cart = $_SESSION['cart_' . $_GET['add']]+='1';
$_SESSION['cart'] = '1';
}
I've tried destroying this:
for ($i=0; $i <2 ; $i++) {
$_SESSION['cart_' . $i] = '0';
session_unset($_SESSION['cart_' . $i]);
}
What am i doing wrong? I just want to destroy the session is a user clicks on home or wants to browse other businesses.