Jump to content


Photo

Passing variables to more than one php page


  • Please log in to reply
3 replies to this topic

#1 nikhilthecool

nikhilthecool
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 June 2006 - 10:50 AM

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

#2 nikhilthecool

nikhilthecool
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 June 2006 - 11:13 AM

somebody please...

atleast give me some alternate solution...plsss...

#3 d_barszczak

d_barszczak
  • Members
  • PipPipPip
  • Advanced Member
  • 188 posts
  • LocationBradford - UK

Posted 14 June 2006 - 01:31 PM

[!--quoteo(post=383712:date=Jun 14 2006, 12:13 PM:name=nikhilthecool)--][div class=\'quotetop\']QUOTE(nikhilthecool @ Jun 14 2006, 12:13 PM) View Post[/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.

When all else fails - Try reading the manual.

Integrated IT Systems Ltd


#4 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 14 June 2006 - 01:46 PM

[!--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) View Post[/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)
z..z..z..z..z..z..z..z..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users