I want to redirect a user after a few seconds without using javascript. Is this possible?

Thanks.

header('Refresh: 3;url=yoururl.com');

Thanks, works great.

Are there ways to do this with normal PHP queries? So dont execute it untill a given time?

<?php
sleep(3); //Wait
header('Location: http://yoururl.com/something'); //Redirect
?>

Try that one
(The first suggestion with redirect is probably better as it will use less system time)

header('Refresh: 3;url=yoururl.com');

Although this piece of code is fine it is recomended to always send redirect/refresh requests as absolute E.G. your request should always be in the form of
http://site/page

u can do this with the help of meta tag as well

<meta http-equiv="refresh" content="8; URL=mypage.php?cmd=done?>">//it will wait for 8 seconds then redirect to other page

But that envolves outputing a HTML page and is not as reliable. With a META tag you would have to output a HTML page and the page would have to load first. With the php Header method it is almost instant redirection without the need to output a HTML page.

Ill try sleep(). Seems like the best solution.

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.