Forums

pass variable via URL to chronoform

busch09 27 Mar, 2010
Hi,
after searching the forum I am stuck:

I have the link to a chronoform:

index.php?option=com_chronocontact&chronoformname=enterpriseQuote

I would like to pass some variables to the form from a link in the prior page like price=1 price=2 price=3

index.php?option=com_chronocontact&chronoformname=enterpriseQuote?price=3

then form should select/populate a drop-down value depending on the price variable.
<option value="">Choose Option</option>

      <option value="Enterprise price 1">Enterprise price 1</option>
<option value="Enterprise price 2">Enterprise price 2</option>
<option value="Enterprise price 3">Enterprise price 3</option>


so in case of price=3 the third option should be selected when the form is called.

if I use %3Fprice%3D3 to have ?price=3 in the URl I get "There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management".

Also how would I pass the variable 3 to the dropdown so the value is selected depending on the variable?
GreyHead 27 Mar, 2010
Hi busch09,

To add new variables to the end of the query string use &name=value There is already a ? earlier in the string (the ? marks the start of the query string and can only be used once).

Bob
kclark 01 Apr, 2010
but how do you pass and receive it?
I am trying to pass an ID # where the link would be chronoform?ID=1234
I have in my form a hidden field that will somehow get this ID# and send it to the db.
My hidden field name is ID, what would the value be?
How do I get the value to be the #?
GreyHead 01 Apr, 2010
1 Likes
Hi kclark,

In the url . . .&chronoformname=xxx&id=1234

In the Form HTML
<?php
if ( !$mainframe->isSite() ) {return;}
$id = JRequest::getInt('id', false, 'get');
?>
. . .
<input type='hidden' name='id' value='<?php echo $id; ?>' />

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