*Running WAMPSERVER 2.0c latest, 5.2.6 PHP.
Hey everyone. I'm learning PHP and I'm having trouble with setting and then immediately referencing session variables. I've searched the forums for a repeat post and I think I see a couple that may be describing my problem, but I'm not seeing any answers in them for fixing in it, so here goes:
I've got a login form for a custom content mangement system that I'm writing that, upon submission with a good password, sets the session variable $_SESSION['loggedin'] to the integer 1. Shortly after this setting is made before the script ends, a check on the same session variable decides what to display in a contextual help window based whether or not the user is logged in (on that variable).
Upon submitting the login form, the page reloads but the session variable 'loggedin' doesn't appear to be set immediately. A subsequent reload of the page and it suddenly seemingly for no reason becomes set. Why is this?
I know this is occurring as described because I am print_r()'ing the the $_REQUEST and $_SESSION variables on every page load in a debug information floating div and you can see that upon form submission with a successfully entered password, the $_SESSION array remains empty despite the successful login. If i either resubmit the same form, or visit the same page by URL again, the $_SESSION array suddenly displays the 'loggedin' => 1...
???