Page 1 of 1

[Solved] Headers already sent from another page

Posted: Mon Jun 26, 2006 2:23 pm
by kendall
hello,

Now usually this is a straight forward solution for me as i have done this nurmeros times however

i have a PHP process which ends with

Code: Select all

header("Location: /some/other/index.php?Msg=$Msg");
exit;
yet i get
Warning: Cannot modify header information - headers already sent by (output started at /../../../docs/index.php:22) in /../../.../docs/set_document.php on line 85
where index is the file the header redirects to and set_document is the file setting the header...

i have no spaces, however index.php does begin to output html...

but that shud be ok shudnt it? u reidrect to another page to show that html

would the fact that the resulting pages are in a frameset account for this?

Kendall

Re: Headers already sent for another page

Posted: Mon Jun 26, 2006 2:26 pm
by RobertGonzalez
kendall wrote:
Warning: Cannot modify header information - headers already sent by (output started at /../../../docs/index.php:22) in /../../.../docs/set_document.php on line 85
Kendall
What happening at line 22 of docs/index.php? If you are not using output buffering then if anything is sent to the browser before calls to header(), session_start() or setcookie() will throw this error.

Posted: Mon Jun 26, 2006 2:36 pm
by kendall
What happening at line 22 of docs/index.php?
ahh sorry line 22 actually outputs HTML <script> tag that includes a javascript file</script>
If you are not using output buffering then if anything is sent to the browser before calls to header(), session_start() or setcookie() will throw this error.
and that is exactly my point....line 22 comes after the header being sent as line 22 is in the index.php...and index.php is what set_document.php is header() to

i had doubled check the javascript file for line space but i didnt find any

isnt that strange?

Kendall

Posted: Mon Jun 26, 2006 3:07 pm
by RobertGonzalez
Is docs/set_document.php including index.php on line 85? Or perhaps vice-versa? The error is coming from docs/set_document.php on line 85 because of output starting in index.php on line 22. I am guessing that maybe there is a call to some other function that uses header() on line 85 of docs/set_document.php that comes after an output from the script.

Posted: Mon Jun 26, 2006 3:12 pm
by kendall
Actualy there is something i really overlooked and understand why i get that error...yoiu are correct indexphp i being used as the main file wile setdocument is getting included my fault...gosh it didnt even show up in the product server

Posted: Mon Jun 26, 2006 3:15 pm
by RobertGonzalez
Hey, at least you found it now, right? Good job.