cjkeane Posted April 7, 2011 Share Posted April 7, 2011 hi everyone. i have been working on a site on a local windows server then moved everything to a unix server. now my refresh doesn't redirect anymore. any ideas why? <?php if(isset($_POST['GO'])){ $page ="go.php?IDNumber=" . $IDNumber; header("Refresh: 1; url=$page"); echo " "; } ?> <form action="" method="post" name="redirect" id="redirect"> <input type="submit" name="GO" id="GO" value="GO" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/232924-php-header-redirect-with-refresh/ Share on other sites More sharing options...
requinix Posted April 7, 2011 Share Posted April 7, 2011 The Refresh HTTP header does not support timed redirects. For whatever reason it is now behaving as it should. header("Refresh: $page"); Quote Link to comment https://forums.phpfreaks.com/topic/232924-php-header-redirect-with-refresh/#findComment-1197999 Share on other sites More sharing options...
dcro2 Posted April 7, 2011 Share Posted April 7, 2011 If you want the browser to go somewhere else immediately, the Location: header would be better for this. header("Location: $page"); Quote Link to comment https://forums.phpfreaks.com/topic/232924-php-header-redirect-with-refresh/#findComment-1198009 Share on other sites More sharing options...
cjkeane Posted April 7, 2011 Author Share Posted April 7, 2011 thanks everyone. i resolved the issue by putting: ob_start(); at the top of the page. Quote Link to comment https://forums.phpfreaks.com/topic/232924-php-header-redirect-with-refresh/#findComment-1198014 Share on other sites More sharing options...
kenrbnsn Posted April 7, 2011 Share Posted April 7, 2011 Using ob_start only hides the problem, it doesn't solve it. It sounds like you were getting a header error which you didn't tell us about which is caused by sending output to the browser before using the header function. Ken Quote Link to comment https://forums.phpfreaks.com/topic/232924-php-header-redirect-with-refresh/#findComment-1198052 Share on other sites More sharing options...
requinix Posted April 7, 2011 Share Posted April 7, 2011 [edit] Er, clicked Quote without realizing it didn't say Modify... Nevermind. Quote Link to comment https://forums.phpfreaks.com/topic/232924-php-header-redirect-with-refresh/#findComment-1198093 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.