hello, could someone show me how to redirect a page in php after a specific amount of time like 5 seconds. thanks

Recommended Answers

All 3 Replies

you can do that in php because php is a server side script. Once it has processed the script and set it to the browser it has no more control of the page. The easiest way is to use javascipt

You can also use META Refresh. As shown below
<meta http-equiv="refresh" content="10;url=http://www.wikipedia.org/" />

Content="10" states how long to wait.
URL states where to redirect to.

Here's the php code

<?php
header('refresh:5; url=new_page.php');
?>

Be very careful NOT to output anything (not even a blank space before the php tag) to the browser before you call the refresh beacause it will give you an error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.