Possible Duplicate:
A set cookie is not found with php
I have set a cookie with php and I can see it is set with my browser. when i try to get it back (from other page on the same website) it seems that doesn’t found.
here is how I set the cookie:
setcookie("login",$login, time()+86400*365);
and I’m getting it back like this:
$_COOKIE['login'];
thanks
Are you setting a cookie then checking if it exists on the same page. Because I’ve tried that and it can only be accessed on a new page load. You can try having a page that sets the cookie then have a page that checks if the cookie exists.
Here is what PHP Manual says:
You may want to
echo $_COOKIE['logon'];or add
setcookie("login",$login, time()+86400*365, "/");