gardan06 Posted October 3, 2006 Share Posted October 3, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/22906-other-means-to-redirect-to-another-page/ Share on other sites More sharing options...
Daniel0 Posted October 3, 2006 Share Posted October 3, 2006 Use output control: http://php.net/outcontrolThe 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. Quote Link to comment https://forums.phpfreaks.com/topic/22906-other-means-to-redirect-to-another-page/#findComment-103290 Share on other sites More sharing options...
micah1701 Posted October 3, 2006 Share Posted October 3, 2006 You can use a <META> Tag in your HTML or JavaScript (if the user has it turned on) Quote Link to comment https://forums.phpfreaks.com/topic/22906-other-means-to-redirect-to-another-page/#findComment-103291 Share on other sites More sharing options...
obsidian Posted October 3, 2006 Share Posted October 3, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/22906-other-means-to-redirect-to-another-page/#findComment-103295 Share on other sites More sharing options...
roopurt18 Posted October 3, 2006 Share Posted October 3, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/22906-other-means-to-redirect-to-another-page/#findComment-103300 Share on other sites More sharing options...
gardan06 Posted October 3, 2006 Author Share Posted October 3, 2006 cool, i used ob_start on the page that says it already sent headers, and it worked. thanks guys ^^ Quote Link to comment https://forums.phpfreaks.com/topic/22906-other-means-to-redirect-to-another-page/#findComment-103306 Share on other sites More sharing options...
saiko Posted October 4, 2006 Share Posted October 4, 2006 put ob_start(); at the start of ur page then ob_end_flush(); at the end :) Quote Link to comment https://forums.phpfreaks.com/topic/22906-other-means-to-redirect-to-another-page/#findComment-103601 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.