I cannot get my page to display user information after they logged in. Help, please?

timlabahn

I am new to PHP/MYSQL. The database works totally fine. I have a username, password, first, and last name field in my database currently. The log in works perfectly fine. I have all the statements needed and whatnot and my code validates whether or not I was able to log in. Here's my predicament...

My form uses the POST method to retrieve the username/password and blah blah blah. I can have it display the username on any other pages by using the session cookies and whatnot. I just need to know how to access my first and last name information.

For example. When the user logs in and they go to the next page, I want it to say: Welcome, Joe Blah. The text, Joe Blah, isn't inputted into the form or submitted any way. It's located IN the database. I just don't know how to access it...

Once again, I'm sorry if some of the terms I used were incorrect. I actually JUST learned how to do this from a good friend of mine who is a web developer. I just need to know a little bit more. I'm catching on pretty well...I just can't seem to find what I'm looking for. I've browsed the internet an hour or so prior to this, and everything that has to do with displaying the user's info has to do with the POST method and they just re-display it on a different page.

Well, thanks again!

Tim

NogDog

When you do the login, you can add any columns you want to the query you use to validate the login. If it's successful, store that data in the $_SESSION array with whatever else you are already storing to indicate that the user is logged in.

timlabahn

Ah, I see. Logically, I thought that would be a good idea; however, I'm not sure what I'd exactly write..? Like, the proper syntax and whatnot. I'm still browsing and finding coding examples. Bare with me...I'm learning quick for only being into this for less than 12 hours.

NogDog

Can you show us the code you're using now (within [noparse]

...

[/noparse] tags) to do the login processing?

speedy78

I am working on the same thing currently. And the problem I am having is figuring out how to get it where my page displays only the user information that is logged in. I'll locate and post my login.php and main.php on my computer shortly and display the code I currently have and a link to the site so that you can view it.