jjmusicpro Posted May 29, 2010 Share Posted May 29, 2010 Not sure why my session values are not working, any ideas here? config_page.php <?php //Config Information session_start(); $_SESSION['portal_title'] = 'Cool Title'; // Portal Title ?> index.php <?php include("includes/config.php") ?> <html> <head> <title><?php echo $_SESSION['portal_title']; ?></title> </head> <body> My title is <?php echo $_SESSION['portal_title']; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/203287-session-values-not-working/ Share on other sites More sharing options...
ZachMEdwards Posted May 29, 2010 Share Posted May 29, 2010 <?php include("includes/config.php") ?> You sure that's the right file? Quote Link to comment https://forums.phpfreaks.com/topic/203287-session-values-not-working/#findComment-1065068 Share on other sites More sharing options...
-Karl- Posted May 29, 2010 Share Posted May 29, 2010 <?php session_start(); //Config Information $_SESSION['portal_title'] = 'Cool Title'; // Portal Title ?> Session start should come before anything Quote Link to comment https://forums.phpfreaks.com/topic/203287-session-values-not-working/#findComment-1065069 Share on other sites More sharing options...
kenrbnsn Posted May 29, 2010 Share Posted May 29, 2010 The session_start function should come before anything that outputs data, since comments don't output anything the way the OP has it is fine. But, it should be in every script that needs to access the $_SESSION array. Ken Quote Link to comment https://forums.phpfreaks.com/topic/203287-session-values-not-working/#findComment-1065070 Share on other sites More sharing options...
jcbones Posted May 29, 2010 Share Posted May 29, 2010 As Zach pointed out, you have named a page "config_page.php" and included it as "config.php". So, no $_SESSION variables were set. Quote Link to comment https://forums.phpfreaks.com/topic/203287-session-values-not-working/#findComment-1065091 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.