HTTP_SESSION_VARS question (another!) - values lost between pages
| From: | Andrew Elliston | Date: | Fri, 10 Nov 2000 20:20:48 +0000 |
| Subject: | HTTP_SESSION_VARS question (another!) - values lost between pages | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24707@lists.php.net to get a copy of this message | ||
First off, thanks to each of you who has offered an answer to my questions about HTTP_SESSION_VARS.
Once I get an understanding of what I'm doing wrong I'll post it back to the list for the
benefit of the archive.
I've vastly simplified things to get at the root of my problem, setting up a system that simply
stores HTTP_SESSION_VARS and goes to a second page to display them. The variables seem to be *lost*
(?!) between the pages, even though nothing is happening to them.
The output of the first page, where the variables are first stored, is:
logged_in ==> yes
_Click here_
The output of the second page, where the variables are retrieved and displayed, is:
logged_in ==>
As you can see...something went wrong, but I can't tell what. Until I get this figured out, I
won't be able to even try to make these things work while passing variables to functions.
I'm running PHP v4.03pl1. Session variables pass between pages without a problem, but when I
try to do it more securely via HTTP_SESSION_VARS, I'm getting this problem. I hesitate to
assume this is some sort of bug, because it seems like a rather large problem, and I'm probably
doing something simple (but wrong).
Here are the contents of the two pages:
index.php:
<?
session_start();
session_register ("logged_in");
$HTTP_SESSION_VARS["logged_in"] = "yes";
while (list($key,$value)=each($HTTP_SESSION_VARS)) {
echo $key.' ==> '.$value.'<br>';
}
echo '<a href="index2.php">Click here</a>';
?>
and index2.php:
<?
session_start();
while (list($key,$value)=each($HTTP_SESSION_VARS)) {
echo $key.' ==> '.$value.'<br>';
}
?>