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> 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? 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 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 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. Link to comment https://forums.phpfreaks.com/topic/203287-session-values-not-working/#findComment-1065091 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.