Session Question - Site Log In
Posted: Tue Jan 25, 2011 2:31 pm
I am new to php, so I'm afraid this may be a complete noob question, but I can't figure it out.
I have a log in system on my site which links to the database and checks user names/passwords. That code works correctly I'm sure. I am able to start a session in that code and print the output I place into the session variables, but what I am not understanding is how to use those session variables in the other site php files.
For ex. From the logIn.php (where the session is started) if they click on the link to profile.php I want the session variables 'username' and 'password' to be transferred to profile.php so that the code can display the profile information corresponding to the users account.
The point of sessions is to pass variables between all the pages in a site correct?
I'm just missing a key point for how to do this.
I have a log in system on my site which links to the database and checks user names/passwords. That code works correctly I'm sure. I am able to start a session in that code and print the output I place into the session variables, but what I am not understanding is how to use those session variables in the other site php files.
For ex. From the logIn.php (where the session is started) if they click on the link to profile.php I want the session variables 'username' and 'password' to be transferred to profile.php so that the code can display the profile information corresponding to the users account.
The point of sessions is to pass variables between all the pages in a site correct?
I'm just missing a key point for how to do this.