Posted by Jasper Bryant-Greene on 11/18/05 05:18
Chuck Anderson wrote:
> Ben wrote:
>
>> Edward Martin said the following on 11/17/2005 04:27 PM:
>>
>>> "Warning: Cannot modify header information - headers already sent by
>>> (output started at
>>> /usr/home/ecmartin/public_html/ethics06/calendarlogin.php:8) in
>>> /usr/home/ecmartin/public_html/ethics06/sas.php on line 34"
>>>
>>
>> It means you are trying to change the page's headers after they have
>> already been sent to the user's browser. You are probably trying to
>> use the header() function after HTML/Javascript/what have you has
>> already been sent to the browser. If you need to use header() you
>> should write any earlier output to a variable and only output it to
>> the browser after any header() function use.
>>
>> - Ben
>>
> Most likely that is exactly what's happening. To be even more clear -
> the solution is to use the header function before any HTML (before *any*
> output). I learned this when I had an include file that was all Php
> causing this problem. The end of the included file had a carriage return
> after the closing tag ?>. That was a nasty one to locate. Now I always
> make sure there is no white space after the closing tag in files I might
> include somewhere else.
An alternative solution is to just turn on output buffering, which will
make sure no output gets sent until after all PHP has stopped processing
(unless you specifically tell it to get sent earlier).
Jasper
[Back to original message]
|