I am trying to track the referring pages that brought visitors to our site. Here is the cookie I have set:
$referer = getenv('HTTP_REFERER');
$value = $referer;
setcookie("cookiename", $value, time()+3600);
This works great if there was a referrer in the HTTP request, but if there wasn't, it bombs out when the page is loaded:
Notice: Undefined index: cookiename in D:\xxx\farnam\xxx\index.php on line 50
How do I set up a null value in the cookie using an if/else statement if there is no referrer?
Thanks for any help!










Bookmarks