munchigum Posted February 25, 2012 Share Posted February 25, 2012 Using PHP and MySQL I made a login script with two pages. But for some reason I keep getting this error: Warning: Cannot modify header information - headers already sent by (output started at /head.php:18) in index.php on line 10 Warning: Cannot modify header information - headers already sent by (output started athead.php:18) in index.php on line 11 Warning: Cannot modify header information - headers already sent by (output started athead.php:18) in index.php on line 25 Warning: Cannot modify header information - headers already sent by (output started at head.php:18) in /index.php on line 26 Does anyone know what the warning is trying to tell me? BTW All the mentioned lines are setting cookies. Quote Link to comment https://forums.phpfreaks.com/topic/257780-creepy-warning/ Share on other sites More sharing options...
JAY6390 Posted February 25, 2012 Share Posted February 25, 2012 This isn't related to regex at all! This is because you're outputting content before your cookies are set, which you can't do. There must be a million articles on why this error happens Quote Link to comment https://forums.phpfreaks.com/topic/257780-creepy-warning/#findComment-1321241 Share on other sites More sharing options...
Pikachu2000 Posted February 25, 2012 Share Posted February 25, 2012 There's a sticky topic that covers this titled, "HEADER ERRORS - READ HERE BEFORE POSTING THEM" Quote Link to comment https://forums.phpfreaks.com/topic/257780-creepy-warning/#findComment-1321244 Share on other sites More sharing options...
JAY6390 Posted February 25, 2012 Share Posted February 25, 2012 ... but that involves reading ... Quote Link to comment https://forums.phpfreaks.com/topic/257780-creepy-warning/#findComment-1321245 Share on other sites More sharing options...
Monkuar Posted February 25, 2012 Share Posted February 25, 2012 ... but that involves reading ... Trust me do it Quote Link to comment https://forums.phpfreaks.com/topic/257780-creepy-warning/#findComment-1321249 Share on other sites More sharing options...
JAY6390 Posted February 25, 2012 Share Posted February 25, 2012 I was being sarcastic It's not me that needs to know how to fix the error lol Quote Link to comment https://forums.phpfreaks.com/topic/257780-creepy-warning/#findComment-1321250 Share on other sites More sharing options...
AyKay47 Posted February 25, 2012 Share Posted February 25, 2012 ... but that involves reading ... but you referred the OP to articles, which involve more reading. Reading is an important factor in learning. Yes this is caused by output being sent to the browser before setcookie() is being called. If there is no "seen" output being sent, the text editor you are using could be using a BOM (Byte Order Mark) for encoding. Quote Link to comment https://forums.phpfreaks.com/topic/257780-creepy-warning/#findComment-1321251 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.