So, in my login script, underneath the "if result of query is true" section, I have the following lines.
setcookie("UserName",$username);
setcookie("UserID",$userid);
Print "Username is: " . $COOKIE['UserName'] . "<BR>". chr(13);
Print "UserID is: " . $COOKIE['UserID'] . "<BR>" . chr(13);
(Please note, there is no expiration time on these cookies, they should expire when the user closes their browser)
When the above runs, I get the following output:
Username is: pwebb0617
UserID is: 32464
...all is good so far, and it looks like my variables have been registered inside my cookies.
Then the next line hits:
header("Location: /header.php");
So it goes to Header.php, and loads it. One of the first lines of header.php is:
Print "Your Username is = ".$COOKIE['UserName']."<BR>".chr(13);
Print "Your UserID is = ".$COOKIE['UserID']."<BR>".chr(13);
and the output I get from all of this is:
Your Username is =
Your UserID is =
???????
Why can't I pull the variable value from the cookies that I just registered less than a second before? Am I missing something here?
I'm running PHP v4.2.3 on a Red Hat Linux 7.3 box with the latest version of Apache and MySQL.
Help!
(Thanks!)
-Paul