BarneyJoe Posted February 25, 2007 Share Posted February 25, 2007 This kind of follows on from another question, but am working backwards, and trying to simply echo some contents from a session. So at the top of my page I have : <?php session_start(); ?> And, using dreamweaver, have my session variable all looking present and correct in the applications > bindings panel. So I presumed all I need to do to echo any of these variables is : <?php echo $_SESSION['username']; ?> ..except nothing is displaying.....? Link to comment https://forums.phpfreaks.com/topic/40026-solved-echoing-session-variables/ Share on other sites More sharing options...
dymon Posted February 25, 2007 Share Posted February 25, 2007 Hi, so as the session variable is an array, try using: <?php print_r ($_SESSION); ?> In this way you will see the full content of the session variable. Link to comment https://forums.phpfreaks.com/topic/40026-solved-echoing-session-variables/#findComment-193583 Share on other sites More sharing options...
Barand Posted February 25, 2007 Share Posted February 25, 2007 Try putting the var inside curlies. echo {$_SESSION['username']}; Link to comment https://forums.phpfreaks.com/topic/40026-solved-echoing-session-variables/#findComment-193584 Share on other sites More sharing options...
BarneyJoe Posted February 25, 2007 Author Share Posted February 25, 2007 Thanks for the suggestions. What I did in the end was look at the profile page - it uses a recordset, and then displays the email from the matching logged in user. So i used the same recordset, and it's doing what i want now - although I'm still not sure exactly why the session variables are available in that way, but won't simply display using echo. (it didn't like the curlies.) Link to comment https://forums.phpfreaks.com/topic/40026-solved-echoing-session-variables/#findComment-193599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.