[PHP] Wait for a while then redirect

Shadow121

Member
Messages
901
Reaction score
0
Points
16
I'm working on a new site in which i want a function that will wait x amount of time defined in hte calling of it then print the redirect script.

Any suggestions on how?
 

Xemnas

New Member
Messages
812
Reaction score
0
Points
0
You should be able to do this with sleep(); the parameter for it is an integer representing the number of seconds you want to delay script execution.

Alternatively, you can just use this line of HTML code:
HTML:
<meta http-equiv='refresh' content='[seconds];URL=main.php'>
 
Last edited:

Shadow121

Member
Messages
901
Reaction score
0
Points
16
Okay, i'll try that.
Edit: That works thanks ^^

Edit 2: I've done that in the past but this time i'm going to keep it XHTML Valid.
 
Last edited:

marshian

New Member
Messages
526
Reaction score
9
Points
0
You wanted a php script, not a meta refresh :p
here's what you want:
PHP:
$time = 3; //Time (in seconds) to wait.
$url = "http://www.google.be"; //Location to send to.
header("Refresh: $time; url=$url");
 
Top