RE: Re: Headers Already Sent - How To Overcome????

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

 



Mike,

While that's not the only way to go somewhere else, if it is the way the
other guy wrote the code to get around, ripping it out an replacing it with
something else could be a problem.  The error message you are referring to
indicates that something was sent to the browser before it attempted to send
a header (usually used to get around).  One line number in the message
refers to a line of code that output something before the header function
was executed, the other to the line number of the header statement itself.

Most common causes of this is a debug message designed to show values of
variables during debug was executed before the header statement.  Solution:
either fix the bug and remove the debug display (usually an echo), or remove
or comment out the debug echo statement.  Probably the second most common
cause is switching to html mode;

Php code goes here ?> and html code goes here <?php code again ?>

In html mode even a blank line will result in stuff being sent to the
browser before the header statement is encountered.  If you nest the html
under an if statement, you can cause it not to generate output.

Hope this helps,

Warren Vail


-----Original Message-----
From: news [mailto:news@xxxxxxxxxxxxx] On Behalf Of MikeA
Sent: Thursday, November 04, 2004 7:06 PM
To: php-windows@xxxxxxxxxxxxx
Subject:  Re: Headers Already Sent - How To Overcome????


Thanks for the answer to my problem.

I tried this and it caused other problems.  Seems like the only way to get
from one place to another is with the header(Location: ) command.  I was
hoping there was something else.

So I am now kind of rewriting this guys application so it works properly.

Again, thanks for the response.

Mike


"Sudeep" <sudeep_zamudra@xxxxxxxxx> wrote in message
news:20041104065211.79082.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> Add this line at the top of the page:
>
> <?php ob_start(); ?>
>
> Your problem will be solved.
>
> ...SuDeEp...
>
> MikeA <mavila@xxxxxxxx> wrote:
> I am trying to do the following
>
> header ("Location: 
> wlserver/index.php?userKey=$userKey&show=$userKey");
>
> but I keep getting
>
> Warning: Cannot modify header information - headers already sent by 
> ...
>
> The code on the header line above is not executing so I am assuming 
> the previous headers being sent is causing this command to not 
> execute. Part
of
> the problem is that I am modifying software written by someone else to 
> fit my needs. I do not want to make a lot of alterations because I 
> don't want to pull my hair out when the next release shows up.
>
> Is there a command or someway to get around this problem without 
> hacking
out
> all of the other header sending code?
>
> I appreciate any help.
>
> Thank you.
>
> Mike
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> ---------------------------------
> Do you Yahoo!?
>  Check out the new Yahoo! Front Page.  www.yahoo.com/a

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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux