I am sorry if this is already requested somewhere in the past. I looked through a few pages and saw nothing. I am trying to write some php to satisfy a need i have. I would like to make links on my page add an sid value based on the referring keyword used to get to the page. This is what i have gotten so far.. <?php $ref=@$HTTP_REFERER; if (strpos($ref,"google",0) ) { $keyword = $_GET["q"]; } elseif (strpos($ref,"yahoo",0) ) { $keyword = $_GET["p"]; } elseif (strpos($ref,"msn",0) ) { $keyword = $_GET["q"]; } else { $keyword = "none"; } ?> Code (markup): <a href="http:mydomain.com?sub=rock+<?php echo $keyword; ?>"> Code (markup): My goal is that the link on the page would add the referring keyword after rock+ and allow me to track the way i want to. When i put this code on the site and run it i get nothing after the + sign when coming from PPC links and +none when coming from an actual web site i set up a link on to test. Any help would be greatly appreciated. I have scoured the web and tried alot of examples but nothing seems to be working for me.
This might help. http://forums.digitalpoint.com/showthread.php?t=198486 $_GET cannot be used for referring URLs.