Page 1 of 1

display user's user when logged in.

Posted: Thu May 05, 2011 11:51 pm
by iskawt
Hi guys. I would like to kindly ask how would you display user's username once he/she logged-in to your site?

Let's say I have home.php and I have a log-in form on my header.

How would I display the user's username on the same position of my log-in form?

How would I hide the log-in form once the user's username is displayed?


Thanks guys..

Re: display user's user when logged in.

Posted: Fri May 06, 2011 8:22 am
by social_experiment
You should check whether a user is logged in, if so, display the username, else display the form

Code: Select all

<?php
 // pseudo-code
 if (isset($username)) {
  echo $username;
 }
 else {
  echo $form;
 }
?>