You are here: Re: header(Location: $var) loops in IE « PHP Programming Language « IT news, forums, messages
Re: header(Location: $var) loops in IE

Posted by Benjamin Esham on 07/13/06 15:05

P-Rage wrote:

> I was wondering what could possibly cause Internet Explorer 6 to loop a
> page usging a header(Location:) statement.
>
> For example, a page called 'page1.php':
>
> if((isset($_POST['var'])) && ($name='valid')){
>
> // insert some data into MySQL.
>
> $location = 'page2.php?name='.$name;
> header(sprintf("Location: %s",$location));
> exit();
> }
>
> FireFox redirects the user to page2.php as planned. But IE6 loops back to
> page1.php (refreshes twice on most occasions). Any ideas? Thanks in
> advance for any help and advice.

Technically, the location you pass should be an absolute URL; try replacing
your code with something more like

header('Location: http://www.example.com/page2.php?name=' . $name);

That may or may not make your page work; I'm not sure.

(By the way, the statement $name='valid' in your if statement probably
doesn't do what you want it to do: it assigns the value 'valid' to $name,
instead of checking to see whether the two are equivalent. If that's an
actual excerpt from your code, change it to $name == 'valid' in order to
avoid unexpected behavior.)

HTH,
--
Benjamin D. Esham
bdesham@gmail.com | AIM: bdesham128 | Jabber: same as e-mail
"...English is about as pure as a cribhouse whore. We don't just
borrow words; on occasion, English has pursued other languages
down alleyways to beat them unconscious and rifle their pockets
for new vocabulary." — James Nicoll

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация