On my local machine (PHP 4.3.4), I have register-globals set to OFF and all my variables are set using the syntax $_SESSION['variable_name']= 'somevalue';
With this syntax, I can access the session variables on all pages of my site.
When I moved my stuff to my new web host (also PHP 4.3.4), they have register_globals set to ON and I can no longer access the session variables with the code
print $_SESSION['variable_name'];
it works on the page where I set the variable, but if I try to access it on another page, the value is empty.
The way I read the PHP manual, $_SESSION is supposed to be the safe way for setting variables regardless of how the register_globals is set. Am I reading this wrong? What am I supposed to be doing?
Other info: the sessionID is set in a cookie and I can read that on the 2nd page using print $_COOKIE['PHPSESSID'];
Are there other settings on the host that could be messing this up?
MY CODE:
http://www.inewsclips.com/Newsclips/php/testing.php
<?php
session_start();
$_SESSION['test']='marisab';
print '$SESSION value "test" set to: '.$SESSION['test']."<BR>";
print 'SessionID is: '.$_COOKIE['PHPSESSID'];
print "<BR><A HREF='./session.php'>next</A>";
?>
session.php contains this code:
<?php
print '$SESSION["test"] set to: '.$SESSION['test']."<BR>";
print '$COOKIE["PHPSESSID"] value set to: '.$COOKIE['PHPSESSID']."<BR>";
?>
...but $_SESSION['test'] appears as empty.
TIA, Marisa