note 11407 added to Session handling functions
| From: | mnirwan at microshell dot com | Date: | Mon, 19 Feb 2001 23:55:37 +0000 |
| Subject: | note 11407 added to Session handling functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11261@lists.php.net to get a copy of this message | ||
I have this in ses1.php
================================
<?php
session_start();
session_register("v_cart");
echo "Previous value is " . $HTTP_SESSION_VARS["v_cart"];
$HTTP_SESSION_VARS["v_cart"] = "Session 1 variables";
echo "<br>New value is " . $HTTP_SESSION_VARS["v_cart"];
echo "<br> Session Id is ".session_id()."<br><a
href="ses2.php">Next</a>";
?>
================================
And this in ses2.php
================================
<?php
session_start();
echo "Previous value is " . $HTTP_SESSION_VARS["v_cart"];
$HTTP_SESSION_VARS["v_cart"] = "Session 2 variables";
echo "<br>New value is " . $HTTP_SESSION_VARS["v_cart"];
echo "<br> Session Id is ".session_id()."<br><a
href="ses1.php">Next</a>";
?>
================================
If i run this it'll output
for ses1.php
Previous value is Session 2 variables
New value is Session 1 variables
Session Id is 5ca6f14674943a73f02754e2431edc00
for ses2.php
Previous value is Session 2 variables
New value is Session 2 variables
Session Id is 5ca6f14674943a73f02754e2431edc00
Seems like the previous variables is not updated. But if I take out the $HTTP_SESSION_VARS and just
leave it with $v_cart it works
fine unless you turn off register_globals, then the above works.
http://www.php.net/manual/en/ref.session.php