I tried to set a session variable in the following manner-
Code: Select all
$_SESSION['varName'] = $_POST['varName'];The $_SESSION['varName'] variable is available on the page where it was set and shows up in the superglobal $_SESSION array (I used a foreach to check every value in $_SESSION). But when I would go to another page, all of the session variable are still available and unchanged save for the one I set above. I've been using sessions for a while and have never seen this behavious before. The variable is not getting unset or reset anywhere in my code and am left wondering why both the index and value for this array entry would not persist past a single page.
I've looked in my reference books and on php.net to double check and explicitly setting the array index to a value is a valid way to set a session variable. I was able to get around the behavious by adding session_register(varName); to my session set up file but this should not be necessary.
Any idea why this would be acting so oddly?