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

<?php		
echo "Your username and password do not match our records";
sleep(3);
header("Location: movie_registration.php");
?>
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by JimD C++ Newb
1

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

<?php
header("Refresh: 3;URL=movie_registration.php");		
echo "Your username and password do not match our records";
?>

This will display the page but tell the browser to refresh after 3 seconds to the new page
Regards,
Sam Rudge

Votes + Comments
Perfect solution to my problem. Thank you!
0

Oh that worked perfectly!

Thank you so much for the explanation! That makes sense to me now.

- Jim

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.