Reputation: 16629
A very novice question. I am trying to set a cookie
<?php
$expire = time() + 24*60*60; //1 day limit
setcookie("name","Foo", $expire);
echo $_COOKIE["name"]; //nothing is displayed
var_dump($_COOKIE["name"]); //returns NULL
?>
I am sure it's something very trivial. Any suggestions?
Upvotes: 0
Views: 41
Reputation: 10643
cookie will be available in your next page load. setcookie
just queues it to be sent along with page headers. $_COOKIE
array contains the cookies that arrives with the request.
Upvotes: 3