| | |
sleep() touble
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 42
Reputation:
Solved Threads: 0
Good morning!
What I am trying to do is: display some text, wait 3 seconds (so the person can read it) and redirect that person to a different web page.
I can get it to either:
1 - Display the text or
2 - Sleep(3) and redirect them to the specific web page.
But I cannot get it to do both.
Can somebody please point me in the right direction?
Thank you in advance
What I am trying to do is: display some text, wait 3 seconds (so the person can read it) and redirect that person to a different web page.
I can get it to either:
1 - Display the text or
2 - Sleep(3) and redirect them to the specific web page.
But I cannot get it to do both.
Can somebody please point me in the right direction?
Thank you in advance
PHP Syntax (Toggle Plain Text)
<?php echo "Your username and password do not match our records"; sleep(3); header("Location: movie_registration.php"); ?>
•
•
Join Date: May 2008
Posts: 232
Reputation:
Solved Threads: 19
There are many problems with that.
1 - Unless you spacificaly tell it, PHP will wait till the end of the script before sending ANY information to the browser so that script would not be sent till after 3 seconds.
2 - If it was shown then header() would not work as headers need to be sent before any data.
3 - Most browsers (IE, Netscape/firefox etc) only update the display every 100bites or so
Try this
This will display the page but tell the browser to refresh after 3 seconds to the new page
Regards,
Sam Rudge
1 - Unless you spacificaly tell it, PHP will wait till the end of the script before sending ANY information to the browser so that script would not be sent till after 3 seconds.
2 - If it was shown then header() would not work as headers need to be sent before any data.
3 - Most browsers (IE, Netscape/firefox etc) only update the display every 100bites or so
Try this
PHP Syntax (Toggle Plain Text)
<?php header("Refresh: 3;URL=movie_registration.php"); echo "Your username and password do not match our records"; ?>
Regards,
Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
![]() |
Other Threads in the PHP Forum
- Previous Thread: vBulletin to ASP.NET
- Next Thread: PHP FTP
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error errors execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javascript joomla keywords limit link login loop mail menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube





