Track where form was launched from

mavbritton 06 Oct, 2009
This is probably outside the scope of Chrono, but I have numerous buttons that open the same forms page. What is the simplest way of passing a value from where the user came from (presumably via a cookie), into the email when the form is completed and sent?

Would anyone mind pointing me in the right direction?

Many thanks

Mark
GreyHead 06 Oct, 2009
Hi Mark,

You don't say what the buttons are - you can add a variable to the url if they are links; or a hidden field if they are mini forms.

Bob
mavbritton 06 Oct, 2009
Sorry, they're images that are just links to the initial form page.

Would you mind explaining briefly how I can pass the variable via the url?

If it helps an example of the page is http://www.severnsidemortgages.co.uk/compare-mortgage-rates/buy-to-let
and the 'continue' button goes through to http://www.severnsidemortgages.co.uk/get-a-quotation which is intial form page.

As you can see, there are 4 to 5 rates per term and then 4 terms per client type, and then 4 client types = lots of points of entry. I didn't think the site design through very well when I first started!

Many thanks

Mark
GreyHead 06 Oct, 2009
Hi Mark,

You pass the info by adding a little query string to the link url something like ?rate=340&completion=1011 but depending on how your information is structured it could be just the id of a database entry ?id=47 or a compound string like ?m=340|1011 In any case you then decode the query string in the Form HTML and use it to pre-populate the form, or just add the value to a hidden field to record it . . .

Bob
mavbritton 08 Oct, 2009
Thats great, thanks Bob I'll give it a try.

Mark
mavbritton 08 Oct, 2009
Sorry about the spoon feeding here, but how do I pass the variable which I have called ?id=remt1 into a hidden field on the form called 'id'? I presume all of this can be done on the form code tab, i just can't see how.

Sorry

Mark
GreyHead 08 Oct, 2009
Hi Mark,

This shoudl do it - can go anywhere in the Form HTML
<?php
$id = JRequest::getInt('id', '', 'get');
?>
<input type='hidden' name='id' id='id' value='<?php echo $id; ?>' />

Bob
This topic is locked and no more replies can be posted.