Reputation:
i just tried
echo $_SERVER['HTTP_REFERER'];
but it returned an error
Notice: Undefined index: HTTP_REFERER in C:\Program Files\....
What is the problem an why is it showing an error.
Upvotes: 1
Views: 695
Reputation:
This is because HTTP_REFERER is not set you can try
if(isset($_SERVER['HTTP_REFERER']))
echo $_SERVER['HTTP_REFERER'];
else
echo 'HTTP_REFERER in not set';
Upvotes: 4
Reputation: 1355
It looks like your server error reporting level is too sensitive (E_ALL) and there actually is no referrer.
Upvotes: 0
Reputation: 40639
Try this,
echo isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER']
: "Referer not set";
Possible Duplicate of $_SERVER['HTTP_REFERER'] missing
Upvotes: 1