is there a Wait x second function?
Moderator: General Moderators
-
Mythic Fr0st
- Forum Contributor
- Posts: 137
- Joined: Sat Dec 02, 2006 3:23 am
- Contact:
is there a Wait x second function?
Im wondering if there is a wait(5.00) second function, so I can say, wait 5 seconds before redirecting
You mean redirecting with PHP, so yes:
Code: Select all
<?php
// Do what you need to do...
sleep(5);
header("Location: next.php");
If you are going to use this to display a message to the user before redirecting like this...
You're going to be in for a nasty surprise...
Code: Select all
<?php
$message = 'We are redirecting you...';
echo $message;
sleep(5);
header('Location: http://www.somewhere.com');
?>Headers already sent on line XX
If you want to add a message you need to use HTML or AJAX.
HTML:
HTML:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Please Wait...</title>
<meta http-equiv="Refresh" content="5; url=http://example.com/index.php" />
</head>
<body>
Wait 5secs or <a href="http://example.com/index.php" title="">click here</a>.
</body>
</html>
I'd go everah's route. sleep()ing before a header() call doesn't make much sense to me since you can't send a message. Do it in the meta tag.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
-
Mythic Fr0st
- Forum Contributor
- Posts: 137
- Joined: Sat Dec 02, 2006 3:23 am
- Contact:
ok
Thanks guys, i'll try it
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
<Off topic>The Ninja Space Goat wrote:that's ok, not everah... but I keep thinking the same thing because of their similar avatars
<--- My penguin is sooo much cooler... just look at him. All cute and fat and rotund and plump. Mmm, makes me want chicken.
</Off topic>
I'd use ok suggestion... HTML meta redirection.
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
