Here is how i am adding the item to a cookie.
addtobasket.php
<?php
include(dirname(__FILE__)."/../config.php");
$product = $_GET['p'];
setcookie("products[$product]", $product,time()+3600,'/','domainehre.com');
echo "$product added to basket";
//Show current basket products
?>
It adds to cookies all great and i can view the cookie all good.
but its not removing with this code:
remove.php
<?php
include(dirname(__FILE__)."/../config.php");
$product = $_GET['remove'];
if (isset($_COOKIE["products"])) {
//Remove product/s from basket
setcookie("products[$product]", "", time()-3600);
echo "Removed $product from basket, <br /> <a href='basket.php'>Click here to go back to basket</a>";
}else{
echo "Basket is empty";
}
?>
What do you guys think it is ?
Thanks
Remove the cookie using the same domain and path it was set with: