user2930650
user2930650

Reputation:

Error in $_SERVER['HTTP_REFERER']

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

Answers (3)

user2533777
user2533777

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

user2959229
user2959229

Reputation: 1355

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

Upvotes: 0

Rohan Kumar
Rohan Kumar

Reputation: 40639

Try this,

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

Possible Duplicate of $_SERVER['HTTP_REFERER'] missing

Upvotes: 1

Related Questions