Jump to content

Archived

This topic is now archived and is closed to further replies.

nikhilthecool

Passing variables to more than one php page

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..!!

Share this post


Link to post
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.

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

×

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.