shakeit Posted March 4, 2008 Share Posted March 4, 2008 Hello, I am getting this error at several places: headers already sent (output started at ......) I think it is a common error, so sorry for asking such a "stupid" question... Does a common rule exist for avvioding these errors? Thank you all... Link to comment https://forums.phpfreaks.com/topic/94271-common-errors/ Share on other sites More sharing options...
DarkerAngel Posted March 4, 2008 Share Posted March 4, 2008 That happens when you try to set headers after something has already been output to the browser. You can change the Error reporting to hide this error. Link to comment https://forums.phpfreaks.com/topic/94271-common-errors/#findComment-482873 Share on other sites More sharing options...
shakeit Posted March 4, 2008 Author Share Posted March 4, 2008 No it doesnt make the "redirect" to the wanted page then ... the same with cookies, t wont save the information in the cookies... Link to comment https://forums.phpfreaks.com/topic/94271-common-errors/#findComment-482874 Share on other sites More sharing options...
discomatt Posted March 4, 2008 Share Posted March 4, 2008 You have to make all header() and cookie() calls before anything is outputted to the browser. Link to comment https://forums.phpfreaks.com/topic/94271-common-errors/#findComment-482876 Share on other sites More sharing options...
shakeit Posted March 4, 2008 Author Share Posted March 4, 2008 What do you mean before its outputted? Link to comment https://forums.phpfreaks.com/topic/94271-common-errors/#findComment-482880 Share on other sites More sharing options...
DarkerAngel Posted March 4, 2008 Share Posted March 4, 2008 Why don't you post some of your code so we can see what your doing and whats going on? Link to comment https://forums.phpfreaks.com/topic/94271-common-errors/#findComment-482882 Share on other sites More sharing options...
discomatt Posted March 4, 2008 Share Posted March 4, 2008 Output is anything visible in the browser (ex: anything you can see when you view source in the browser). This can be html, echo() calls, print() calls, ect. Your best bet is to check out the output buffer functions.. and use a buffer to catch anything that would be outputted, and flush it to the browser at the end of the script http://ca.php.net/manual/en/ref.outcontrol.php Link to comment https://forums.phpfreaks.com/topic/94271-common-errors/#findComment-482884 Share on other sites More sharing options...
shakeit Posted March 4, 2008 Author Share Posted March 4, 2008 Why don't you post some of your code so we can see what your doing and whats going on? Yeah I would but there are so many places I get this error, hehe... anywayz I tried this solution by putting header an session_start() before anything else, and it works.. But what if I want to use header() in the middle of a html page :-S Thats the issue, but i get the idea... thanx... Link to comment https://forums.phpfreaks.com/topic/94271-common-errors/#findComment-482905 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.