warstormer Posted August 3, 2007 Share Posted August 3, 2007 Hi, I want to do a page redirect but without using: header("Location: http://somesite.com"); as it needs to be done at the end of a page after other code has been run... is there an equivalent to the ASP response.redirect? Quote Link to comment https://forums.phpfreaks.com/topic/63194-solved-non-header-php-page-redirect/ Share on other sites More sharing options...
akitchin Posted August 3, 2007 Share Posted August 3, 2007 you can either use output buffering (which captures output and sends it out as a header once the script is finished running, or at your command using a function to flush), or you could echo a meta refresh tag into the HTML itself. Quote Link to comment https://forums.phpfreaks.com/topic/63194-solved-non-header-php-page-redirect/#findComment-314966 Share on other sites More sharing options...
almightyegg Posted August 3, 2007 Share Posted August 3, 2007 function redirect($time, $link) { echo "<meta http-equiv=\"refresh\" content=\"{$time}; url={$link}\" /> "; } redirect(0, "REDIRECT URL HERE"); $time = time in seconds before it redirects. Quote Link to comment https://forums.phpfreaks.com/topic/63194-solved-non-header-php-page-redirect/#findComment-314976 Share on other sites More sharing options...
warstormer Posted August 3, 2007 Author Share Posted August 3, 2007 function redirect($time, $link) { echo "<meta http-equiv=\"refresh\" content=\"{$time}; url={$link}\" /> "; } redirect(0, "REDIRECT URL HERE"); $time = time in seconds before it redirects. Thanks dude, worked perfect.... Quote Link to comment https://forums.phpfreaks.com/topic/63194-solved-non-header-php-page-redirect/#findComment-314985 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.