Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to assign session variables from login page?

Status
Not open for further replies.

Apollo6

Technical User
Joined
Jan 27, 2000
Messages
418
Location
US
This maybe part HTML question but also PHP...

I have a login page where I have user_id and password input fields. Once both are entered, user clicks submit. How do I go about setting session variables from this page to pass to the next page(s)?

My inputs are as follows:
Input Name="user_id" id="user_id"
Input Name="passwd" id="passwd"

 
When the form is submitted, the script to which the form submits can accept the form data and copy the values to the session variables.

Just issue session_start() in the receiving script and assign values to elements in the $_SESSION superglobal array. The values will come from the $_POST or $_GET arrays.

Subsequent pages will then also issue session_start(), and reference the values in the $_SESSION array.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top