header() and meta http-equiv='refresh'

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
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

header() and meta http-equiv='refresh'

Post by tores »

Hi

I can't seem to get automatic redirection to work (using firefox 1.0.6)

Code:

Code: Select all

header('meta http-equiv="refresh" content="3;url=http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'"');
Why doens't this work? Isn't meta-headers supported by header?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

a meta refresh is html a header is not.

Code: Select all

header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'"');
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

Post by tores »

Code: Select all

header('Refresh: 3;url=http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
Redirects after 3 seconds.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

tores wrote:Redirects after 3 seconds.
be warned, that's web server specific.
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

Post by tores »

be warned, that's web server specific.
Exactly what part is server specific? If you refer to the $_SERVER variables, then I got it covered.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your header() code, only certain servers support sending a "refresh" header.
Post Reply