Page 1 of 1

Cookies having to be set twice

Posted: Mon Jul 07, 2008 11:52 am
by GeXus
I've been having some issues with cookies... Here's the code i'm using to test

Code: Select all

 
<?
$guid = rand(0,500);
setcookie('guid', $guid, time()+(60*60*24*365));
print_r($_COOKIE);
echo $_COOKIE['guid'];
?>
 
The way I would expect this to work is to set the cookie and print the cookie... but instead, it only displays the cookie info if I refresh the page, any ideas? and no I don't want to use sessions.

Re: Cookies having to be set twice

Posted: Mon Jul 07, 2008 11:55 am
by GeXus
Another thing that is weired, is even if the cookie is showing as set (after refresh), if I try to print that cookie from another page, it doesn't print.