redirect

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
murlopaz
Forum Commoner
Posts: 60
Joined: Wed Oct 11, 2006 5:02 pm
Location: Baltimore, MD, USA

redirect

Post by murlopaz »

Is there a way to redirect the user to another page by using PHP?
I know there are two alternatives include and header. But what if I have to call the redirect from the middle of the page, when the header was already sent.
I've heard about redirecting with meta tags, but it seems there is a bug in FireFox related to metatags.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

  1. engineer the page's code such that all the logic is processed prior to any output
  2. drop some Javascript or other client side language that does the redirection inline (if you're in the page code)
  3. do a meta redirect if you're in the html headers still
The preference is toward "a."
murlopaz
Forum Commoner
Posts: 60
Joined: Wed Oct 11, 2006 5:02 pm
Location: Baltimore, MD, USA

Post by murlopaz »

the problem is that meta redirect doesn't always work with firefox...
that's the problem i have now, and I am trying to fix that wihtout making radical changes to the script
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I have yet to have a problem with Firefox and meta-redirection as long as they are in the correct location: the page headers.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Why can you not perform a header() redirect before output?
Post Reply