setcookie statements are giving me error
| From: | Ryan Schefke | Date: | Wed, 14 Apr 2004 18:42:28 +0000 |
| Subject: | setcookie statements are giving me error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183363@lists.php.net to get a copy of this message | ||
I'm trying to set multiple cookies and getting the error below. I removed
all of the white spaces and extra lines before and after my <?php and ?>,
so, that shouldn't be an issue. I get the error for each cookie and it
echoes back as "...cookie not set" like I coded.
This is the code chunk I'm trying to run, which is called using "require
("setcookie.php");" from my main script. There aren't any extra spaces in my
main script because I can replace the require line with "header ('Location:
http://www.anything.com');" and it will
redirect successfully without any
cannot modify header errors, which tells me there's nothing wrong with my
main script. Am I doing something wrong with cookies here?
"Warning: Cannot modify header information - headers already sent by....."
setcookie ("acctActive_ck", "$daysRemaining"); //set cookie for active
account, will terminate when browser window closes
if (setcookie("acctActive_ck")) { echo "active cookie set"; } else { echo
"active cookie not set";}
setcookie ("login_ck", "$lo"); //set cookie for active account, will
terminate when browser window closes
if (setcookie("login_ck")) { echo "login cookie set"; } else { echo "login
cookie not set";}
setcookie ("password_ck", "$pw"); //set cookie for password, will terminate
when browser window closes
if (setcookie("password_ck")) { echo "pw cookie set"; } else { echo "pw
cookie not set";}
Thanks a million,
Ryan