ali_2kool2002 Posted March 26, 2007 Share Posted March 26, 2007 Hi can someone help me resolve this error it keeps sayin notice of undefined constant? :'( [quote]Notice: Use of undefined constant id - assumed 'id' in h:\Project\htdocs\fiinalyear\homePage.php on line 59[/quote] and on line 59 i have [code] <? if(isset($_SESSION[id])){echo"--------- <b>Welcome $_SESSION[id]</b>--------";} ?> I do have a session_start() after the body of the html aswel [code <body> <? session_start();?> [/code] Link to comment https://forums.phpfreaks.com/topic/44379-session-error/ Share on other sites More sharing options...
per1os Posted March 26, 2007 Share Posted March 26, 2007 Thats the problem. Session_start has to be before ANY output is sent to the browser. Link to comment https://forums.phpfreaks.com/topic/44379-session-error/#findComment-215527 Share on other sites More sharing options...
tom100 Posted March 26, 2007 Share Posted March 26, 2007 It's a problem, but the notice you are getting is because you are referencing "id" without any single quotes. Normally that would mean it is a predefined constant, but since PHP is smart, it just throws a notice and converts it to 'id'. Change $_SESSION[id] to $_SESSION['id'] and put session_start at the very top of the code and you should be ok. Link to comment https://forums.phpfreaks.com/topic/44379-session-error/#findComment-215529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.