Page 1 of 1

$_server['http_referrer'] problem

Posted: Wed Apr 30, 2003 6:15 am
by RedRasper
Hi,

Can someone help me. I have no idea why I keep getting this error, as as far as I can find out the syntax is correct.

header("Location: $_SERVER['HTTP_REFERER']");

The error I get is:

PHP Notice: Undefined index: 'HTTP_REFERER' in c:\apache\apache2\htdocs\TMP6yxo8e5lhx.php on line 7.

Thank you to anyone who can help!


RedRasper

Posted: Wed Apr 30, 2003 7:34 am
by twigletmac
Basically, a value for HTTP_REFERER hasn't been set - you could test to see if the information exists and redirect to a default page if it hasn't:

Code: Select all

$redirect_url = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'http://www.mysite.com/default.php';
header("Location: $redirect_url");
Mac