Freedom-n-Democrazy Posted October 4, 2011 Share Posted October 4, 2011 In the PHP manual, under session_start(), it says: To use cookie-based sessions, session_start() must be called before outputting anything to the browser. Does this mean I cannot place it in the middle of a HTML file? What about if I put it on line 1 of a HTML document (before the DOCTYPE! (HTML 4.01))? Link to comment https://forums.phpfreaks.com/topic/248379-positioning-session_start/ Share on other sites More sharing options...
MasterACE14 Posted October 4, 2011 Share Posted October 4, 2011 before ANY output. What about if I put it on line 1 of a HTML document (before the DOCTYPE! (HTML 4.01))? That would be fine, like... <?php session_start(); // some PHP stuff ?> <html> <head></head> <body> .... Link to comment https://forums.phpfreaks.com/topic/248379-positioning-session_start/#findComment-1275494 Share on other sites More sharing options...
Deoctor Posted October 4, 2011 Share Posted October 4, 2011 You have to place it on the top of any display in the page. something like this <?php session_start(); ?> <html>..........</html> Link to comment https://forums.phpfreaks.com/topic/248379-positioning-session_start/#findComment-1275495 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 4, 2011 Author Share Posted October 4, 2011 Fantastic. Thank you very much guys for the confirmation. Link to comment https://forums.phpfreaks.com/topic/248379-positioning-session_start/#findComment-1275496 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.