Notice: Undefined index: HTTP_REFERER
$http_referer = $_SERVER[\'HTTP_REFERER\']
i used this from tutorial.and it looks okay
also code is calling it
HTTP_REFERER is not guaranteed to be sent by the client:
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
In your case it's clearly not being sent, so really all you can do is
if(isset($_SERVER['HTTP_REFERER'])) {
//do what you need to do here if it's set
}
else
{
//it was not sent, perform your default actions here
}
The Correct way to reffer is
$my_referer = isset($_POST['referer']) ? trim($_POST['referer']) : (isset($_SERVER['HTTP_REFERER']) ? base64_encode($_SERVER['HTTP_REFERER']) : false);
if (isset($_SERVER['HTTP_REFERER'])) {$THE_REFER=$_SERVER['HTTP_REFERER']}
Undefined index means the array key is not set, do a:
var_dump($_POST); die();
before the line that throws the error and see that you're trying to get an array key that does not exist.