PDA

View Full Version : seeks redirect alternative to header()



a_design_interactive
03-09-2006, 04:15 PM
i'm getting the classic Warning: Cannot modify header information - headers already sent by ...
i'm wondering if there's something i can use-- javascript-wise, which will allow me to get around this w/out causing any harm to the integrity of the app?

i forget how to fix the headers problem, and furthermore-- it's an include() issue which i'm thinking will be more tricky to fix the header issue than usual. (used to get the header thing all the time, but i figured out how to fix it a while ago-- hence why i can't recall momentarily)

any ideas?

thanks!

it's basically an if / elseif thing where i need, upon elseif to send the user to a particular page. thanks!

Twey
03-09-2006, 05:12 PM
You can do this client-side using:
<meta http-equiv="0;url=page-to-go-to.html" />in the head of your page. However, doing it server-side is better. To understand the nature of your problem, you must know (basically) how HTTP works. First, the page headers are sent; then comes the main body of the file. To seperate the two, two CRLFs are used. Obviously, once the headers have been sent, you can't pull them back and edit them. The way to avoid this error, then, is to perform all header() calls before you output any HTML.

mwinter
03-09-2006, 05:56 PM
However, doing it [redirection] server-side is better.Yes, much. :)


The way to avoid this error, then, is to perform all header() calls before you output any HTML.Which isn't as awkward as it may seem if output buffering (http://uk.php.net/manual/en/ref.outcontrol.php) is employed.

Mike