...

View Full Version : php cookies not working



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

$myusername="esther";
$mypassword="pass";

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

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

CFMaBiSmAd
03-28-2007, 06: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?

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum