I have something goofy going on with sessions, and I've been searching for the answer for hours. Here goes:
When I change the value of a Session variable, it seems to change retroactively, meaning any instance of this variable on that page BEFORE the change reflects the value AFTER the change.
Assume $SessionVariable was set on a previous page to "Bob".
- session_start();
- echo $SessionVariable;
- session_register("SessionVariable");
- $SessionVariable = "Fred";
The "echo" statement on line 2 will output "Fred" even though the variable isn't changed to that value until two lines later. This is problem because I'm trying to display a session variable on a page, then clear it immediately after displaying it.
I've tested this over and over and confirmed in several instances that this is what the code is doing. I have searched through half a dozen sites tonight in search of the answer. I'm so confused now that I may have stumbled over the answer and just not known it.
Can anyone help?
Deane