Losing Session Variable, Kinda
Posted: Sat Sep 02, 2006 10:40 pm
I don't understand really how session variables work so prior to explaining my problem; I'll let you know where I currently stand.
I setup my site to use templates. At the top of each page there are includes, to include the headers, logon form, and navigation tabs.
1. I included session_start in my header template right before it sends anything to the browser.
2. After the header loads, then I include "templates\forms\logon.php" this is a form that allows the user to login. Once the logon is successful, $_SESSION['username'] = $_POST['username'].
Now that 1 and 2 are both done,
I show a form to the user to enter stuff, when I go to enter stuff into the database; I added this.
$requester = $_SESSION['username'];
It keeps return NULL!?!?
Now the weird thing is that what I stated above, 2., shows "Welcome tmaiden"
It pulls the tmaiden from $_SESSION['username']; in a seperate file "templates\forms\logon.php"
But when "templates\forms\logon.php" is loaded on the page with the form to enter other stuff, $_SESSION['username'] returns NULL
Any suggestions?
THanks.
I setup my site to use templates. At the top of each page there are includes, to include the headers, logon form, and navigation tabs.
1. I included session_start in my header template right before it sends anything to the browser.
2. After the header loads, then I include "templates\forms\logon.php" this is a form that allows the user to login. Once the logon is successful, $_SESSION['username'] = $_POST['username'].
Now that 1 and 2 are both done,
I show a form to the user to enter stuff, when I go to enter stuff into the database; I added this.
$requester = $_SESSION['username'];
It keeps return NULL!?!?
Now the weird thing is that what I stated above, 2., shows "Welcome tmaiden"
It pulls the tmaiden from $_SESSION['username']; in a seperate file "templates\forms\logon.php"
But when "templates\forms\logon.php" is loaded on the page with the form to enter other stuff, $_SESSION['username'] returns NULL
Any suggestions?
THanks.