problem with cookies

kaits

Mitglied
test this:

creating a cookie:
SetCookie("name","hello bla bla",time()+60*60*24*365); //for a year...

reading the cookie:
echo $_COOKIE['name'];
 
the problem you have is exactly the path. There
is an option which allows the cookie to access to all subdiretories.
Here a working example:

PHP:
setcookie("Name", "Value", time()+36000000, "/");
"/");

This part is doing what you want your cookie to do. :-)
See also at http://www.php.net/setcookie
 
Zurück