thelee Posted November 10, 2012 Share Posted November 10, 2012 hello.im creating a website.i want to show the user name after they logged in and for those who dont register i want to leave any msg. when the user login it will show welcome "the user name" but when the user dont log in,it will be a error, can someone help me. here is the code <?php session_start(); echo "Welcome ".$_SESSION['MM_Username']; else (isset($_SESSION['MM_Username'])) { echo "why you dont register?"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/270525-display-users-name-after-login-php/ Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 (edited) It's hard to follow your explanation. I assume you have already set the $_SESSION variables so just do: <?php session_start(); if(isset($_SESSION['MM_Username'])) { echo "Welcome ".$_SESSION['MM_Username'].""; } else { echo "why you dont register?"; } ?> Edited November 10, 2012 by SocialCloud Quote Link to comment https://forums.phpfreaks.com/topic/270525-display-users-name-after-login-php/#findComment-1391425 Share on other sites More sharing options...
thelee Posted November 10, 2012 Author Share Posted November 10, 2012 case solved ! thanks to social cloud ! love u muah Quote Link to comment https://forums.phpfreaks.com/topic/270525-display-users-name-after-login-php/#findComment-1391427 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 Don't forget to mark the topic as solved Quote Link to comment https://forums.phpfreaks.com/topic/270525-display-users-name-after-login-php/#findComment-1391435 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.