Kunkka Posted June 1, 2009 Share Posted June 1, 2009 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 Link to comment https://forums.phpfreaks.com/topic/160505-i-cant-direct-to-the-home-page-with-welcoming-the-username-which-logged-in/ Share on other sites More sharing options...
anupamsaha Posted June 1, 2009 Share Posted June 1, 2009 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 Link to comment https://forums.phpfreaks.com/topic/160505-i-cant-direct-to-the-home-page-with-welcoming-the-username-which-logged-in/#findComment-847042 Share on other sites More sharing options...
fry2010 Posted June 1, 2009 Share Posted June 1, 2009 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> Link to comment https://forums.phpfreaks.com/topic/160505-i-cant-direct-to-the-home-page-with-welcoming-the-username-which-logged-in/#findComment-847071 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.