[Solved] Sent url value with form

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
Masweb
Forum Members
Forum Members
Posts: 173
Joined: Sat May 09, 2009 4:26 pm

[Solved] Sent url value with form

Post by Masweb »

On serveral website pages I've made a button to sign in or get infomation. With this button I sent some infomation of that page in the url.

On the form page I can print that information.
But I can't get it to work to sent this infomation with the form.(Formbuilder)

Is that possible and how do I do this?

This is the code I'm getting the infomation in the url:

Code: Select all

<a href="{cms_selflink href='inschrijven'}?value={$entry->title|cms_escape}-{$entry->postdate|cms_date_format}">inschrijven</a>

This is the code for getting te information out of the url

Code: Select all

if ( isset( $_GET['value'] ) ) { // controleren of $_GET['value'] bestaat
  echo '<p>' . $_GET['value'] . '</p>';
  }
else {
  echo '<p>Uw vraag is verzonden!</p>';
  }
Last edited by Masweb on Mon Mar 17, 2014 3:42 pm, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Sent url value with form

Post by velden »

You can pre-populate a FormBuilder field with a value. Read FB module help -> Advanced tab -> 'Passing Default Values to Forms'

You can use Smarty too to get the value from url (maybe you want to do some validation first).

Example (read help first):

Code: Select all

{FormBuilder form='my_form' value_FIELDNAME=$smarty.get.value}

if that does not work:
{FormBuilder form='my_form' value_FIELDNAME={$smarty.get.value}}
Note that you need to create the field in Form Builder. I think you should use a field of type 'hidden field'.
Masweb
Forum Members
Forum Members
Posts: 173
Joined: Sat May 09, 2009 4:26 pm

Re: Sent url value with form

Post by Masweb »

Great! Works for me! Thanks. :)
Post Reply

Return to “The Lounge”