shakeit Posted November 15, 2007 Share Posted November 15, 2007 Hello Everyone. I've been sitting for quite a while now, reading the sleep() manual and tried to turn the code upside down and inside out but nothing helps... I want the current page to wait a few seconds before it is directed to another ( after a successfull registration ). So i thought the best way to do that is to use sleep(). However, this does work to a certain point ... the current page waits for 5 seconds, but the text I want to show the user in the meantime doesn't show? Why? Without the sleep() and the header() it shows without any problem. Can anyone please help? if( $add_user == 1 ) { // This method returns true if the registration is successfull $check = $min->register($name, $adress, $age, $email, $phone, $country,$city, $newsletter, $uname, $password, $password2 ); if( $check ) { $name = ""; $adress = ""; $age = ""; $email = ""; $phone = ""; $country = ""; $city = ""; $newsletter = ""; $uname = ""; $password = ""; $password2 = ""; echo "Successfull registration"; // <-------- THIS STRING DOESN'T SHOW sleep(5); header("Location: $loginHeader"); } } Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted November 15, 2007 Share Posted November 15, 2007 sleep() will sleep in the execution of the script thus resulting in the script "hanging" (at least it will look like that to the user). You should simply use a Refresh header instead of a Location header if you wish to delay the redirection. Refresh: 5; url=http://example.com Quote Link to comment Share on other sites More sharing options...
shakeit Posted November 21, 2007 Author Share Posted November 21, 2007 Thanx a lot - it worked :-) 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.