Jump to content

Archived

This topic is now archived and is closed to further replies.

gardan06

other means to redirect to another page..

Recommended Posts

well, i'm having trouble with the header() function, as i always get a "headers already sent" message. so i was wondering..

are there other ways of redirecting someone to another page aside from using the header function?

Share this post


Link to post
Share on other sites
Use output control: http://php.net/outcontrol

The reason of the error is that you output something before sending a header, and you can't do that since headers are the very top of the HTTP request.

Share this post


Link to post
Share on other sites
You can use a <META> Tag in your HTML or JavaScript (if the user has it turned on)

Share this post


Link to post
Share on other sites
the best way is just to handle your logic before you send any header information to the browser if at all possible. this is much more easily handled in larger scripts by using templates or some other sort of control to allow you to determine [b]when[/b] the output is actually sent.

Share this post


Link to post
Share on other sites
Instead of constantly echo'ing output from PHP, try appending it into a single $Page or $HTML variable.  At the very end of your script echo that single variable and you should be set.

Share this post


Link to post
Share on other sites
cool, i used ob_start on the page that says it already sent headers, and it worked. thanks guys ^^

Share this post


Link to post
Share on other sites
put ob_start(); at the start of ur page then ob_end_flush(); at the end :)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.