Forums

Linking to form with URL variable

chumby 10 Aug, 2011
Hi there,

Is there a way I can link to a joomla article - and in the link have a hidden/url form element that is transferred to the form and then emailed with the form when submitted?

ie... <!-- w --><a class="postlink" href="http://www.mysite.com.au/book.htm?type=regular">www.mysite.com.au/book.htm?type=regular</a><!-- w --> booking

or www mysite.com/book.htm?type=super_booking

and then when the "booking" form on book.htm is submitted, either regualar_booking or super_booking are passed through depending on the original link clicked.

Hope that makes sense..

Cheers
Chumby
chumby 11 Aug, 2011
Any ideas?

Appreciate the help...

Cheers
Chumby
GreyHead 12 Aug, 2011
Hi chumby,

Something like this:
<?php
$type = JRequest::getString('type', '', 'get');
?>
. . .
<<input type='hidden' name='type' id='type' value='<?php echo $type; ?>' /> 

Bob
chumby 12 Aug, 2011
Hi Bob,

Thanks for this... but not sure where this code goes. Is it on the page linking to the form on another page?

Cheers
Chumby
GreyHead 12 Aug, 2011
Hi chumby,

In the Form HTML in CFv3 or a Custom Element in CFv4.

Bob
chumby 12 Aug, 2011
Ok Bob,

I am using CF V4 so will put it in there.

What does the link look like from the page that gets me to the form?

eg

<!-- w --><a class="postlink" href="http://www.mysite.com/link_to_page_with_form?option=1">www.mysite.com/link_to_page_with_form?option=1</a><!-- w -->

<!-- w --><a class="postlink" href="http://www.mysite.com/link_to_page_with_form?option=2">www.mysite.com/link_to_page_with_form?option=2</a><!-- w -->

<!-- w --><a class="postlink" href="http://www.mysite.com/link_to_page_with_form?option3">www.mysite.com/link_to_page_with_form?option3</a><!-- w -->

where link_to_page_with_form is the Joomla article where the form is stored.

Thanks
Chumby
GreyHead 13 Aug, 2011
Hi chumby,

It will look like the examples you posted earlier example.com/link_to_page_with_form/?type=regular or possibly example.com/link_to_page_with_form&type=regular depending on whether there is already a ? in the link_to_page_with_form part.

Bob
GreyHead 15 Aug, 2011
Hi chumby,

Only if you have lots of links or menu entries I suspect. I was just following your request to link with a URL. It might be better here to pick up the article id?

Bob
chumby 16 Aug, 2011
Sorry Bob,

Don't quite get you mean there....

Cheers
Chumby
GreyHead 17 Aug, 2011
Hi Chumby,

You started out saying that you wanted to use URLs like <!-- w --><a class="postlink" href="http://www.mysite.com.au/book.htm?type=regular">www.mysite.com.au/book.htm?type=regular</a><!-- w --> booking but now you seem to want something different?

Bob
chumby 18 Aug, 2011
Hi Bob,

Sorry if my first example was misleading. I am still wanting the same thing.... see if I can exaplin it better here...

Users visit my website on the Url below:
http://www.cooperautomotive.com.au/index.php?option=com_content&view=article&id=123&Itemid=241

and then select and service and request a type of booking. They are then transferred to the booking form:
http://www.cooperautomotive.com.au/index.php?option=com_content&view=article&id=68:bookonline&catid=35:website&Itemid=94

At the moment when they get to the form though, I have no idea of what type of booking they want. What I would like is somekind of value to passed from the first page t the second page where the form is which indicated what type of booking they want. This can then be emailed when the form is submitted.

Cheers
Chumby
GreyHead 19 Aug, 2011
Hi Chumby,

These links are presumably in the article text so just add to the link as you first suggested:
http://www.cooperautomotive.com.au/index.php?option=com_content&view=article&id=89:quote&catid=35&Itemid=92&type=premium_service

Bob

PS I'm not clear why you are embedding the form in an article rather than lining directly to it?
chumby 20 Aug, 2011
Ok thanks Bob... didnt think it would be that simple.

So when the form is submitted, the type variable can be emailed through also?

I have also linked to embedded forms in articles... is there a better way to do it?

Cheers
Chumby
GreyHead 20 Aug, 2011
Hi Chumby,

1) Yes - see my post way back at the beginning of this thread.

2) Yes - you can use the direct link to the form. This is preferred unless you really need to embed the form in an article.

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