My session variables won't persist, could someone help me with this problem? 
I spent all day trying to figure out what is wrong, and I still don't know 
why I couldn't get it to work. Here is an example script:
header("Pragma: no-cache");
header("Refresh: 2");
echo "session id: $sID<br>";
echo "session var: ".$_SESSION["var"]."<br>";

function fnA(){
function fnB(){
                echo "session var is set...<br>";
                echo "session var is not set...<br>";
                echo $_SESSION["var"];

Here is the out put from this script:
session id: ee030ac6e15ea2c01e1dd4fe40f3ab30
session var:
session var is not set...
The session ID is the same for a given session, that means the server knows 
its the same session. And since I get the value "1" each time, I can see 
that the $_SESSION["var"] is a global variable with a value of "1". But it 
seems that once the script is finished, this variable runs out of scope! A 
session variable should persist for the duration of the session. It should 
not run out of scope like this. Could someone with more experience tell me 
what am I doing wrong? Thanks in advance.


Join the world’s largest e-mail service with MSN Hotmail. 

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to