PHP: How to display the users name when they are logged in?
I’m just after making a php script that checks the user and pass to login to the main page, which is working, the next bit is to display their username and theirs only, how is this done?
When you check their username/password against the database, just put their username into a session variable:
$_SESSION[‘username’] = $_POST[‘username’];
Then just echo the session variable:
echo $_SESSION[‘username’];
Leave a Reply
You must be logged in to post a comment.