Forum Moderators: DixonJones
php,perl,asp,other?
You would need to include the code on every page of your site grab the referer, if not set, and then stick it in a cookie or session variable. Then when someone fills in the form you check that variable and put it into the email or in a database.
you can use include [ca.php.net] to put your script into every page. Make sure it is before anything else otherwise it won't work.
Like other headers, cookies must be sent before any output from your script
You can use setcookie [ca.php.net] to actually set the cookie.
Whenever you look at functions on php.net always read through the user comments underneath. Often there is a good example similar to what you would like to do.
As for getting the referer, it is part of the $_SERVER array and is accessed like so $_SERVER['HTTP_REFERER'] [ca.php.net].
Hope that helps.