Page 1 of 1
I swear I havn't sent any headers? Please help
Posted: Sun Jun 20, 2004 8:15 pm
by grahamcracka1
I really want to just add a simple
header("Location: url");
to my script but it is saying that I sent headers. The file that it refers to as having sent the headers doesn't appear to have sent any, or echo'ed any text. And the line number is the very bottom line... Any help would be appreciated...
Posted: Sun Jun 20, 2004 8:16 pm
by markl999
Whitespace and blank newlines etc also count as output, check the file that claims to have sent output doesn't have any white space before or after the <?php ?> tags
Posted: Sun Jun 20, 2004 8:19 pm
by crabyars
It sounds like you've already done this, but maybe triple check any include files that get called before <body> for trailing carriage returns. I had a similar problem recently and it turned out that one of includes was generating a small error message. I finally found out by moving those includes into the body so I could see what was happening. Hope this helps, let us know how it goes.
EDIT-> yeah, what James Bond said!
Posted: Sun Jun 20, 2004 9:22 pm
by litebearer
As an alternative, you could use a javascript redirect or a meta tag redirect. Both will function even if 'headers' have already been sent.
Posted: Sun Jun 20, 2004 11:41 pm
by seevali
<?php
ob_start ();
?>
Use the above function on top of the page for output buffering. I think this will work.
Or else javascript can be used to redirest the page
<javascript>
location.href= URL ;
</javascript>
Posted: Mon Jun 21, 2004 2:26 am
by Dr Evil
Keep away from Javascript redirects.
You can not be sure this will work for everyone (javascript disabeld).
Posted: Mon Jun 21, 2004 3:59 pm
by grahamcracka1
ahh i think i had a carriage return below my ?> tag!!