View Full Version : php cookies not working

03-28-2007, 06:58 PM
i am doing the following code


setcookie("username", $myusername, time()+3600);
setcookie("password", $mypassword, time()+3600);

for some reason this is not setting the cookie?
what am i doing wrong?

03-28-2007, 07:05 PM
99.5% of the time when cookies (and sessions and header redirects) don't work, it is because some content is being sent to the browser prior to the setcookie() function call.

Put the following two lines in after your first opening <?php tag -

ini_set ("display_errors", "1");
error_reporting(E_ALL);Also, how do you know they are not being set? What symptoms do you see?

03-28-2007, 07:16 PM
thanks so much -- that helped me find the issue!