View Full Version : Redirect to current page (reload)?
I was wondering, what's a reliable way to redirect to the current page (reload page)? In other words, retrieve the current URL in the browser's window. If I use:
header("Location: $PHP_SELF");
it works in IE, but not NS.
Thanks!
firepages
11-29-2002, 02:30 AM
Hi well that is a reliable way, perhaps you are testing on an unreliable browser :)...
Do you mean NS <6 ? as it works fine for me on Moz , I no longer have an NS4.* version on my comp so I can't test that.
perhaps try losing the space (should not matter though ?)
header("Location:$PHP_SELF");
if you have PHP v4.2 or greater you 'technically' should be using
<?header("Location: {$_SERVER['PHP_SELF']}");?>
though that in itself should make no difference to the output.
one thought if you have register_globals=off then perhaps $PHP_SELF is empty & you require $_SERVER['PHP_SELF'] , how IE and NS handle an empty header may vary but thats a guess :)
Thanks firepages. The browser is NS4.
Interestingly I tried simply reconstructing the entire current URL, using something like:
$currenturl="http://" . $SERVER_NAME . $PHP_SELF;
Depending on whether I used IE or NS, the outcome contained an additonal "/" between server and file name:
http://www.mydomain.com//myfile.htm
So it would seem the two browsers do detect things a little differently.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.