ylkien Posted December 6, 2006 Share Posted December 6, 2006 Hi guys,I am trying to create a simple script to display some messages, wait, then forwarding it to another page. The problem I have is that it won't display anything if I use the function "sleep". This means, it will straightway goto the redirected page w/o displaying any message...It will display the message if I use "ob_flush" & "flush", but when trying to redirect it, the error "...headers already sent by..." comes out.Below is a snipper of the code :[code]function Transfer_Back( $Sleep_Time ){ echo "Hello"; ob_flush(); flush(); Sleep( $Sleep_Time ); Header("Location:http://localhost");}[/code] Quote Link to comment Share on other sites More sharing options...
bqallover Posted December 6, 2006 Share Posted December 6, 2006 If you want to output stuff before redirecting, you could use the 'refresh' meta tag in the <head> section of your html[code]<meta http-equiv="Refresh" content="3;URL=http://localhost">[/code]will redirect the browser to 'http://localhost' after 3 seconds.Hope that helps! BTW, using meta refresh won't go down well with some accessibility validators, as it's a bunch of no fun for speech screen readers. Quote Link to comment 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.