Jump to content

Passing variables to more than one php page


nikhilthecool

Recommended Posts

Hi

I have a login form in which i submit the username and password this way...

<form action="index.php" method="post">
<input type="text" name="username">
<input type="text" name="password">

<input type="hidden" name="option" value="login">
<input type="submit" name="Submit" class="button" value="Login" >
</form>


Now, i after i submit the login form i need to submit the login information. So i use the hidden field option so that it goes to index.php?option=login ...(Is it so? I'm not sure)

Also I need to submit the same information to another page where i need to use option=forum

Now how do i do this? Basically, i'm trying to modify my application so that user need not login two times(in the website and forum differently)

Please Help..!!
Link to comment
Share on other sites

[!--quoteo(post=383712:date=Jun 14 2006, 12:13 PM:name=nikhilthecool)--][div class=\'quotetop\']QUOTE(nikhilthecool @ Jun 14 2006, 12:13 PM) [snapback]383712[/snapback][/div][div class=\'quotemain\'][!--quotec--]
somebody please...

atleast give me some alternate solution...plsss...
[/quote]

Once your users have logged in you can store the variables in a cookie or using php sessions.

Once you do this all your other php pages can that access these variables.

Sessions are better as they run from the server side but webhosts sometimes dont allow them and cookies can be stopped by a user that turns off cookies.
Link to comment
Share on other sites

[!--quoteo(post=383760:date=Jun 14 2006, 02:31 PM:name=scripts2go.co.uk)--][div class=\'quotetop\']QUOTE(scripts2go.co.uk @ Jun 14 2006, 02:31 PM) [snapback]383760[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Once your users have logged in you can store the variables in a cookie or using php sessions.

Once you do this all your other php pages can that access these variables.

Sessions are better as they run from the server side but webhosts sometimes dont allow them and cookies can be stopped by a user that turns off cookies.
[/quote]
In this case (web host disallows, or no cookies) you can make a custom session running from a database, transfering the "session id" via HTTP_VARS. (assuming you have a database on the host)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.