--- Elfyn McBratney <[EMAIL PROTECTED]> wrote: > > Is the following code the best way to redirect someone to a > > different page using PHP? > > > > <?php > > header("Location: http://www.yahoo.com"); > > ?> > > That's also known as "breaking the back button", but is the only way > to do it in PHP. A better way to redirect someone (and keep the back > busson working) is to use the meta html tag.
I'm not sure what you mean by breaking the back button. I think you're talking about when you click back and are immediately forwarded again, which is annoying for users. This is typically the case of a Refresh (whether HTTP header or http-equiv meta tag) set with a 0 second delay. So, I think you've got it backward, because the Location header does not have this problem, since the redirect is transparent to the history mechanism. Also, when you're using PHP, it is rare that it is going to be better to use a meta tag to emulate an HTTP header. PHP has the header() function, and it can set real headers. Hope that helps. Chris ===== Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php