PHP Session Variables not staying set on next page
Posted on 2008-01-28
I have a PHP script that I use every year around this time. Last year it worked fine, this year it doesn't. I wondered if anyone could see what I'm missing...
I have a login script that users type their username/password in. Once the info is verified via MySQL I move on to the next page using this code:
$userid = $row["ID"];
//Set cookie and seesion info
setcookie("admin", "loggedin", time()+3600);
setcookie("userid", "$userid", time()+3600);
$_SESSION["userid"] = $userid;
When I test it by printing the userid is it being set. (i.e. 20 will print on the screen).
When I move on to the next page, the $_Session variable is no longer set. The first few lines of Grid.php are:
At this point the $_Session variable is blank and that's what prints on the screen (nothing).
Has something changed about Sessions or is there something I'm missing. I use a web host so I don't have a lot of control over PHP. Any help would be appreciated!