Authentication form that sends username to next page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
snow4cast
Forum Newbie
Posts: 2
Joined: Sat Dec 06, 2003 7:59 pm

Authentication form that sends username to next page

Post by snow4cast »

I need some quick help on a Login page. It should send the username the next page, where it will pull and display the MySQL database information based on login name.

I also need them to populate fields.

Any help is greatly appreciated.

Thank you.
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

If you're calling the next page with a form, then on the next page the username would be in the $_POST['username'].

Or, if you're calling the next page with a URL (page.php?user=username), then on the next page you would access it with $_GET['user']

Understand?
snow4cast
Forum Newbie
Posts: 2
Joined: Sat Dec 06, 2003 7:59 pm

Post by snow4cast »

First of all, thank you for your quick response.

The second page I got under control. It's the process of using one one submit button to both check login info, and second, send the information to the second page, probably in a URL push.

Would I need two form actions, and if so, how is the syntax constructed for that?
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

Nah, Just do this. If you form action is post, then name the submit button like name="btnSubmit" or something. Then at the beginning of the first page..

if ($_POST['btnSubmit']) {
// Check Login Stuff

// Call the second page passing the stuff by URL push.

}
Chambrln
Forum Commoner
Posts: 43
Joined: Tue Dec 02, 2003 10:45 am
Location: Oregon

Post by Chambrln »

You could also create a session variable to hold the username and not pass it via forms.
Post Reply