PDA

View Full Version : Reading Cookies


Chris Hunter
10-27-2002, 02:07 PM
I was wondering how i could use the cookie information?

i stored them before in that way:

setcookie("cook_usrname",$name,time()-5600,"","",0);
setcookie("cook_usremail",$email,time()-5600,"","",0);

i want to refill a form for placing comments to photos and i dont want to force the user to retype his information each time he wants to write a comment..

site is
http://www.kummerkaestchen.com/pics

thanks for helping...

mordred
10-27-2002, 02:19 PM
Normally you can read any cookie values through the associative array $_COOKIE, or $HTTP_COOKIE_VARS if you're working with an older PHP version.

See also
http://us.php.net/manual/en/reserved.variables.php#reserved.variables.cookies

But I'm not to sure that you're setting the cookie correctly - you define an expire date in the past, effectively deleting any cookies by that (time() - 5600). Perhaps the examples on http://us.php.net/manual/en/function.setcookie.php show this in greater detail.