show a message before redirecting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jiehuang001
Forum Commoner
Posts: 39
Joined: Mon May 12, 2003 12:53 pm

show a message before redirecting

Post by jiehuang001 »

For some webpage, when i click the "download" link to download something, I got a message like this "you will be directed to the download page in 5 seconds. Otherwise, please cllick here"

How can I make a link with similar functions? That is, when the link is clicked, some message shows up first. After several seconds, the user will be redirected to another page.

Thanks


Jie Huang
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Post by mikusan »

Code: Select all

<BODY onLoad=window.setTimeout("location.href=''download.php?action=download''",5000)>
				<B>You have chosen to download &#123;download_name&#125;<B>
				<BR><BR>
				<small><b>Note:</b>This window will redirect in 5 seconds<BR><BR>
				Don't want to wait?<a href="download.php?action=download.php">click here</a></small>
				</BODY>
This took me some time to make sure worked nicely, i am surprised i wan't able to find something like this myself...
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

stick this in your HEAD tags

Code: Select all

<meta http-equiv="refresh" content="5;url=yoururlhere.php">
then have your page as normal, it will redirect to the url after 5 seconds.
Post Reply