Deivas Posted March 7, 2010 Share Posted March 7, 2010 How come that if i do that at my homepage it prints out the username. if(isSet($_SESSION['username'])) { echo $_SESSION['username'];}else{ echo "lol"; } if I do that in another directory it prints out lol. Link to comment https://forums.phpfreaks.com/topic/194425-how-come/ Share on other sites More sharing options...
wildteen88 Posted March 7, 2010 Share Posted March 7, 2010 It will always echo out the username provided the session variable $_SESSION['username'] exits. Whenever working with sessions always add session_start at the top of every page. You probably didn't do this in your "other directory" that is what it doesn't display the username. Link to comment https://forums.phpfreaks.com/topic/194425-how-come/#findComment-1022699 Share on other sites More sharing options...
Deivas Posted March 7, 2010 Author Share Posted March 7, 2010 Ok thanks I knew it but I forgot about it Thanks Link to comment https://forums.phpfreaks.com/topic/194425-how-come/#findComment-1022700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.