My setcookie() isnt working, please help....


New member
To see if you're really setting the cookie, use this line at first in your script:


This way you'll be notified about every little error in your script.
HTTP headers (E.g.: Set-Cookie) must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
So... make sure any kind of output is being sent first of your setcookie().

Note: This happens to me sometimes - Remove all blank lines after the last php code block in your PHP files.
hi if you are using firefox install the LiveHttpHeaders plugin, it helps you see the REQUEST and the RESPONSE headers
there in the Response header you must see "Set-Cookie" parameter, only then would the browser be able to set the cookie
If i'm not wrong, in the manual there's a recomendation about its use:

$time = time() + 3600;
setcookie("aauname", $uname, $time);