Re: PHP Header issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Lucas wrote:
> Ernie Kemp wrote:
>>  
>>
>> <html> 
>>
>> <head> 
>>
>> <title>Contact Us</title> 
>>
>> </head> 
>>
>> <body> 
>>
>> <?php header("Location: advertise2.php"); ?>
>>
>> </body> 
>>
>> </html>
>>
>> The above is just snippet of the code but even this simple example throws
>> the Header Warning / Error.
>>
>> Warning: Cannot modify header information - headers already sent by (output
>> started at /home/content/g/t/a /html/yourestate/advertise.php:6)
>> in/home/content/g/t/a /html/yourestate/advertise.php on line 6
>>
> 
> http://us2.php.net/manual/en/function.header.php
> 
> From the manual page:
> 
> Quote:
> "Remember that header() must be called before any actual output is sent, either
> by normal HTML tags, blank lines in a file, or from PHP. It is a very common
> error to read code with include(), or require(), functions, or another file
> access function, and have spaces or empty lines that are output before header()
> is called. The same problem exists when using a single PHP/HTML file."
> 
>> The anwser may be simple but I have looked a blanks or spaces around the
>> <?php ?> with no success.
>>
>> Ready need your help.
>>
>> Thanks,
>>
>> Ernie Kemp   
>>
>> Phone: 416 577 5565
>>
>> Email:   ekemp@xxxxxxxxxxxxxxxx
>>
>> ...man will occasionally stumble over the truth, but usually manages to pick
>> himself up, walk over or around it, and carry on.
>>  
> 
> Isn't that the truth!
> 
>> Winston S. Churchill 
> 
> 
> 

Just to point out to everybody, you can actually do this.  And most of you
probably already know how.

You can use output buffering.  :)

if you use ob_start() anywhere in your code before this statement, or you have
output_buffering option enabled in the php configuration.

Now, with that said, using output buffering to "fix" this "problem" is the wrong
solution.  But it does work.

Jim


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux