Thursday, August 16, 2012

PHP Location Redirect Error IE

This will be short. You try using the PHP location command to redirect or refresh your page. It works in Firefox but you notice that IE cuts you off with "Page cannot be displayed" error.

Look at your code very carefully:

I had this:
header("location:".$_SERVER["PHP_SELF"]);
exit();

Notice the lowercase "l" and the lack of a space after the colon, this was the problem, this fixed it:

header("Location: ".$_SERVER["PHP_SELF"]);
exit();

Apparently, IE can be picky about this...

Also, make sure you include the exit, it is important...

No comments:

Post a Comment