Cookies having to be set twice
Posted: Mon Jul 07, 2008 11:52 am
I've been having some issues with cookies... Here's the code i'm using to test
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.
Code: Select all
<?
$guid = rand(0,500);
setcookie('guid', $guid, time()+(60*60*24*365));
print_r($_COOKIE);
echo $_COOKIE['guid'];
?>