I'm creating a small store and using cookies to store bought items. When an item is added to cart I do something like:
document.cookie="itemname=added";
Then I have a button to go to cart and in php I do:
foreach($_COOKIE as $cookie=>$value)
{
if ($value=="added")
...something
}
Everything works except than I need to reload the page for the items to show in the cart. It also work if I add a ?u=randomvalue
to cart links but it's very annoying for some reasons.
This is my html header:
<!DOCTYPE HTML>
<html lang="fr">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link href="/style.css" rel="stylesheet" type="text/css">
<title>Shop</title>
<meta name="description" content="">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
</head>
Is there something I'm forgetting ?
Thanks