What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Passing a php variable to a form's hidden field

    Asked by bgi on May 25, 2014 at 02:40 PM

    Hi,

    I have a number of product pages on my site and want to put a contact form on each page but I'd like when the form is submitted for the product name to be passed from the page through to a hidden field on the form. Is this possible?

    Currently in the old PHP form that I want to replace, it says:

    input type="hidden" name="productname" value="item->name;?>

    Can this be embedded in some way in the jotform and/or does it matter which embed method I use (currently using Joomla embed with javascript)
    Warren
    Page URL:
    http://bgibarriers.com/en/products/arm-barriers/light-arm-barriers

    hidden php form contact form JotForm name
  • Profile Image
    JotForm Support

    Answered by jonathan on May 25, 2014 at 04:47 PM

    Hi Warren,

    You can use the form's Send Post Data feature to post submission data using PHP.

    Refer to this guide also -How-to-Post-Submission-Data-to-Thank-You-Page

     

    To find out the PHP codes and variable names, you can test submit your form first to https://www.jotform.com/show-post-data

    OR

    follow this guide -Getting-the-Variable-Names-and-PHP-code-in-Send-Post-Data-method

    Hope this help. Inform us if you need further assistance.

    Thanks!

     

     

  • Profile Image

    Answered by bgi on May 25, 2014 at 05:09 PM

    Thanks Jonathan,

    I'm using your Zoho integration to pass form data through to Zoho and that is why I need the product name in a field so that Zoho CRM knows which product has triggered the lead and so can assign it to the right person and trigger other events.

    I'm not sure I understand this Send Posts Data method completely but it doesn't seem to be the right thing to get the variable into the field that will then be available in the Zoho CRM integration field mapping.

    Warren

  • Profile Image
    JotForm Support

    Answered by jonathan on May 25, 2014 at 07:09 PM

    Hi Warren,

    It seems I overthink your requirement and misunderstood it instead. Sorry for that.

    BUT Yes, you can pre-populate a form hidden field also by using field URL parameter. 

    Check this user guide -Prepopulating-fields-to-your-JotForm-via-URL-parameters

    Test submit this form http://www.jotform.me/form/41447670804456?source=producttest

    In the submission, the hidden source field should have value of "producttest"

    What you also need to do first on your PHP product page is to assign the productname value to a variable so that you can use it in the JotFrm form URL.

    Something like this

    http://www.jotform.me/form/41445563619459?source={productname}

     

     Hope this help. Inform us if you need further assistance.

    Thanks!