Redirecting after a page has been displayed

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
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Redirecting after a page has been displayed

Post by mjseaden »

Hi,

Commonly when you use header() to redirect, you get an error if any previous content has been executed.

How, then, do some websites display a message saying ('you should be redirected within X seconds - if you are not, click here') etc.?

This is what i need to do.

Many thanks

Mark
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Not done with PHP usually...it is done with simple HTML

Google for "Meta Refresh"
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

js will do this for you too

you can use the setTimeout method to have it redirect at whatever time you specify. Pimp is right though, meta refresh is what is normally done and the 'better' solution for sure.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

These pages are usually intermediate pages that serves the only purpose of processing information then redirection.

Code: Select all

<html>
<head>
<title>title</title>
<meta http-equiv="refresh" content="10; url=http://www.someurl.com/">
</head>
10 would be the number of seconds to wait until redirection, the url would be the page that's being directed to
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.
Post Reply