I'm trying to retain user information across pages using sessions. So far I've had no luck. I can initiate the session on the first page just fine (the session file contains all the correct variable info) but when I go to the next page and call the session vars, all the vars are blank. SID is always blank and the only way I can propagate the session ID is by including it like a normal GET var in the URL; this doesn't help either since all the vars turn up blank anyway.
Here is the first page:
<?php
$my_session_variable="YABBA";
$_SESSION['my_session_variable'] = $my_session_variable;
?>
<?php
echo "Here is the next page <a href=session2.php?&id=".$SID."> CLICK </a><br>";
echo "Here is the next page <a href=session2.php?&sid=".session_id()."> CLICK </a><br>";
foreach ($HTTP_SESSION_VARS as $k => $v) {
echo "yup is $HTTP_SESSION_VARS[$k] <br>";
}
?>
Here's the second page:
<?php
session_start();
echo "Value of sid: ".$GET['sid']."<br>";
echo "Value of var: $my_session_variable <br>";
echo "Value of var: ".session_name()."<br>";
echo "Value of var: ".session_id()."<br>";
echo "Value of var: ".$HTTP_SESSION_VARS['my_session_variable']."<br>";
echo "Value of var: ".$SESSION['my_session_variable']."<br>";
echo "Value of var: ".$GET['my_session_variable']."<br>";
echo "Value of var: ".$POST['my_session_variable']."<br>";
?>
The only lines that print anything are line #2 (prints original session ID; same one as in URL), line #4 (prints "PHPSESSID") and line #5 (prints a new session ID, different from line #2).
Running PHP 4.2, Apache 1.3.24, track_vars enabled, register_globs off, no cookies. Any help or suggestions would be greatly appreciated.
Og