Jump to content

i cant direct to the home page with welcoming the username which logged in


Kunkka

Recommended Posts

how can i put the username which user logged in

 

i have check if the user is rite the page will direct to the home.php. but in home.php i want to show the username in the page.

 

how can i do that

 

Please read about session().

http://www.php.net/session

 

1) put this at start of your page:

 

<?php session_start();

// code goes here

?>

 

2)When a user logs in and the home.php page is displayed, make sure before you send the header, you have set the $_SESSION[''] variable up so that the name is displayed on the first load. So:

 

<?php session_start();

  $user = $_SESSION['user'];

  ?>

  <html>
    <head><title>Hello</title>
    </head>
    <body>
      <?php
        echo $user;
      ?>
    </body>
  </html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.