Forum Moderators: coopster
Im fairly new to php but am trying to find out if theres a way by using php that you can get a users search request that led them to your site ( so you can then write it along with the customers order to a mysql database)
ie if a person searched for blue widgets and then landed on your site- is there a way to capture this info along with the referer with php?
Ive already managed to get the referer - if its coming from a predetermined url such as www.bobswidgetlinks.com?referer=211 but would like to be able to do it accross the board.
many thanks in advance
We have a nice thread of PHP tricks in our library. One such trick is how to highlight searched terms [webmasterworld.com]. The method of retrieving the data is identical. You are going to be using the superglobal $_SERVER['HTTP_REFERER'] [us3.php.net] to get the data. Then once you get the data, you just insert it into the database. And remember to escape those variables :)
Good luck!