RE: [PHP] redirect using php

From: Date: Wed, 05 Apr 2006 13:30:19 +0000
Subject: RE: [PHP] redirect using php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-233256@lists.php.net to get a copy of this message
If it helps here's the code I use to redirect <?php function chrome_redirect($url) { // redirect the page if (headers_sent()) { // perform JS redirect echo '<script type="text/javascript" language="javascript"><!-- document.location.href=\'' . $url . '\'; // --></script>'; } else { // no headers sent... much nicer header redirect header('location: ' . $url); die(); } } ?> HTH Dan ----------------------------------------------------- Dan Parry Senior Developer Virtua Webtech Ltd http://www.virtuawebtech.co.uk -----Original Message----- From: Mark Kelly [mailto:php@wastedtimes.net] Sent: 05 April 2006 14:19 To: php-general@lists.php.net Subject: Re: [PHP] redirect using php On Wednesday 05 April 2006 13:55, Chris Shiflett wrote: > Mark Kelly wrote: > > You can also use something like: > > > > echo "<meta http-equiv=\"Refresh\" > > content=\"0;url=$from_page\">"; > > There's no need to use a meta tag to mimic HTTP headers. PHP provides > the header() function. I have been using that method when I got part-way through some processing that produces output, and hit something that requires a redirect. As I understand it headers are no use to me here. I'm very much a beginner, so if this is the wrong way to do this, I'd appreciate pointers. Thanks for the reply, either way. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.1454 (20060321) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com

« previous php.general (#233256) next »