I'm using a session variable to pass data from one page to the next. On the first page I have something like :
$_Session['MyVar'] = $first_page_var; // this var contains user input, if any
When I get to the following page, I check the session var to see if it contains any value like :
$second_page_var = $_Session['MyVar'] ;
But even if $first_page_var was set to "" (meaning the user typed in nothing) $second_page_var still reports some value. In this case it is two non-printable chars. I have no idea where these are coming from.
Just for fun I hard coded the session var to empty on the first page like :
$_Session['MyVar'] = "";
The when I checked the value of $second_page_var, it was indeed empty. But when I checked $_Session['MyVar'] on a third page like :
$third_page_var = $_Session['MyVar'] ;
Those two non-printable chars were back! This is driving me nuts. Is there some way to stop the session var from spontaneously generating its own content here?
I even tried this :
session_unregister('MyVar');
But the problem continued.