Forums

get referring page URL into form field

futureit 29 Nov, 2013
Hi There,

I have a custom enquiry form setup for Virtuemart Products in Chronoforms. I would like to get the referring URL into one of the text box's automatically. I've tried this from a few angles with no luck.

e.g. where in Chronoforms would I put the below (if this is the correct syntax)

<?php
echo $_GET['link'];
?>

Thanks in advance🙂
GreyHead 29 Nov, 2013
Hi,

Just as a footnote here. ChronoForms v4 will automatically add all of the GET and POST variables to the $form->data array so you don't normally need to re-add them.

Bob
futureit 03 Dec, 2013
No it's not being passed as 'link'.

I can try at coding that in though....

I just thought there might have been an easy script to allow me to record the referring URL in the form.

Thanks!
futureit 03 Dec, 2013
Ok got it to pass the Product name, which for my instance will do!
For anyone else trying:

On the joomla product page I've made a custom link to open the Chronoform Quote form and pass the product name via the URL.

<a href="http://prismproducts.com.au/index.php?option=com_chronoforms&chronoform=Quote&product_name=<?php echo $this->product->product_name ?>">Get A Quote</a>


In Chronoform I added a 'Custom Code Event' to the form On Load as per sloanthrasher

<?php
$form->data['link'] = $_GET['product_name'];
?>


Then created a Text Box named 'link'.

and viola!! Thanks for your help🙂
GreyHead 03 Dec, 2013
Hi futureit,

Well done, you can shortcut one step in this; ChronoForms will have added the value to $form->data['product_name'] so if you give your input the name 'product_name' then the value will be automatically set.

Bob

PS There is a Joomla! URI object that you can also use to get information from the URL. You can use it with code like this
<?php
$uri =& JFactory::getURI();
$form->data['product_name'] = $uri->getVar('product_name');
?>
There are a lot more methods if you hunt around; unfortunately the Joomla! documentation is a mess at the moment so there is nothing I can find there to point you to :-(
nitinl 05 Feb, 2014
Hi Bob,
Even i am facing same problem. What is product_name? Will you please describe the process step by step.
This topic is locked and no more replies can be posted.