melting_dog Posted November 1, 2011 Share Posted November 1, 2011 Hi guys, I am trying to retrieve some information from sessions. I have this in my header.php <?php if(isset($_SESSION['username'])){ $username = $_SESSION['username']; echo $username; } ?> Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/ Share on other sites More sharing options...
trq Posted November 1, 2011 Share Posted November 1, 2011 And the problem is? Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/#findComment-1283933 Share on other sites More sharing options...
melting_dog Posted November 1, 2011 Author Share Posted November 1, 2011 Sorry guys, I just posted this before but must have hit send in its incompleted state. What I meant to say is: Hi guys, I am trying to retrieve some information from sessions. I have this in my header.php <?php if(isset($_SESSION['username'])){ $username = $_SESSION['username']; echo $username; } ?> And it works fine - $username returns and prints the correct string. But when I try the same echo on another file (that includes() header.php) I just get the word 'root' - not the actual user name Can anyone help me with this? Thanks again! Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/#findComment-1283935 Share on other sites More sharing options...
trq Posted November 1, 2011 Share Posted November 1, 2011 You sure your not overriding the $username variable somewhere along the line? Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/#findComment-1283942 Share on other sites More sharing options...
melting_dog Posted November 3, 2011 Author Share Posted November 3, 2011 Hi Thorpe - yes that seems to have been the problem! Cheers Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/#findComment-1284606 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.