1

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.

3 Answers3

4

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';
1

Try this,

echo isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER']
                                     : "Referer not set";

Possible Duplicate of $_SERVER['HTTP_REFERER'] missing

Community
  • 1
  • 1
Rohan Kumar
  • 40,431
  • 11
  • 76
  • 106
0

It looks like your server error reporting level is too sensitive (E_ALL) and there actually is no referrer.

user2959229
  • 1,360
  • 2
  • 11
  • 21