Page 1 of 1

I want to add a field to the form to show where they came from

Posted: Tue Oct 26, 2010 4:40 am
by ozdecor
hello
I've searched here butto no avail.
I want to add a field to the form to show  where they came from. We have visitors from different locations like referrers websites or adwords, and we wantto have a hidden field on the form to chw us where the person came from before they filled the form out. IS this possible?

Thanks
ian

Re: I want to add a field to the form to show where they came from

Posted: Fri Oct 29, 2010 2:27 am
by colinmcc
Yes, the referrer's url is available to PHP in $HTTP_REFERER, so get it into a variable like this:

Code: Select all

$referer=@$HTTP_REFERER; 
and then in your form use $referer as the value of your hidden field.

Re: I want to add a field to the form to show where they came from

Posted: Fri Nov 19, 2010 5:46 am
by ozdecor
i added
$referer=@$HTTP_REFERER;
as the value for the hidden field, and it still does not pass the referrer info on. What am i missing?

ian

Re: I want to add a field to the form to show where they came from

Posted: Fri Nov 19, 2010 10:17 am
by Peciura
Make sure "Process smarty tags within field?:" is ticked for hidden field.
Value should be
{$smarty.server.HTTP_REFERER}