Page 1 of 1

Warning: Cannot modify header information - headers already

Posted: Wed Jan 30, 2008 5:26 am
by hannnndy
hi friends

please help i seriously face this problem again

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\htdocs\

please help

Code: Select all

 
ob_start();
    echo('test');
    header('Location: http://www.google.com');
ob_end_clean();
 
the test even not printed i do not know what to do

Re: Warning: Cannot modify header information - headers already

Posted: Wed Jan 30, 2008 6:22 am
by webspider
header() must be called before any output is sent. check any html output is sent to browser before calling header.

Re: Warning: Cannot modify header information - headers already

Posted: Wed Jan 30, 2008 6:49 am
by Chris Corbyn
webspider wrote:header() must be called before any output is sent. check any html output is sent to browser before calling header.
Read up on ob_start() and friends ;)

Re: Warning: Cannot modify header information - headers already

Posted: Wed Jan 30, 2008 6:50 am
by Chris Corbyn
Test won't be printed because you're using ob_end_clean() instead of ob_flush() or "echo ob_getClean();". That code alone shouldn't be giving you headers already sent errors though. Unless you have some whitespace before the <?php tag.

Re: Warning: Cannot modify header information - headers already

Posted: Wed Jan 30, 2008 7:12 am
by webspider
Read up on ob_start() and friends ;)
really........ :oops: