Forums

get value from url

johannes 22 Feb, 2008
Hi,

Is it possible to get a value from an URL?

Like:
index.php?option=com_chronocontact&chronoformname=brochure&name=value


Case is that I would like to be able to have a select list pre selected when entering the form, after clicking on "order brochure" in a content item. So then the type of brochure is selected OR just displayed without a select list.

I suppose I should have a hidden input type form element in the content item, so I can use the GET attribute in the URL.

As you see, I have an idea but I'm not sure how exactly and if Joomla likes an URL like this.

Hope someone has a better idea then I do!😉

Thanx!

Johannes
GreyHead 22 Feb, 2008
Hi Johannes,

Basically GET values are passed in the URL and POST values are passed by form inputs.

If you have a link in your content page then you can (I think) add a parameter and then use it by referring to $_GET['name'] in your form HTML. (Not tested but should work I think.)

Or you could create a mini-form with a hidden field (using ChronoForms if you like) and embed it in your content item with the mambot. In this case you pick up the value from $_POST['name'].

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