Including script output (javascript and PHP) in form submit

  • Profile Image
    Asked on February 26, 2013 at 05:17 PM


    We are using a form for tech support of our live cameras. To be able to identify and solve the user's problem, we need to collect information about their internet connection and PC or mobile device. I have written a few scripts (in PHP and javascript) to get this information and we need to include the output of these scripts (a few variables) in the form submit, so we can analyze this data along with the information provided by the user in the form.

    The content of the variables must be included in the form submit, each one on it's own form field. It doesn't make a difference if this information is visible to the user or not, however the user must not be able to modify them. 


    The form URL is:


    Here is the list of variables we need the content included in the form:

    PHP variables:



    $velocidade (internet connection speed)

    Javascript variables

    $window.ui.browser (browser name)

    $window.ui.version (browser version)

    $flash9028 (browser has flash 9.0.28 or above installed)

    $flashver (flash version)

    $video (browser supports any kind of HTML5 video)

    $webm (browser supports HTML5 video: webm)

    $ogg (browser supports HTML5 video: ogg)

    $mp4 (browser supports HTML5 video: mp4)


    Here is a working version of the scripts:

    Internet connection speed test page: 

    Results page: (all of the above variables are in here)


    The source code of the scripts can be downloaded from:


    Thanks in advance,

    Bruno Facca

  • Profile Image
    Answered on February 26, 2013 at 05:36 PM

    Hi Bruno,

    Have you check the feature Send Post Data yet?

    Here are some of the guides:

    1. How-to-Post-Submission-Data-to-Thank-You-Page

    2. Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page

    3. How-to-Insert-Update-Submissions-to-Your-MySQL-Database-Using-PHP

    The main thing here is it will enable you to post the results into the Thank You page after submit.

    Hope this help. Do inform us should you have more inquiry.


  • Profile Image
    Answered on February 26, 2013 at 07:13 PM

    Hi Jonathan,

    Thanks for the reply, however post the results into the Thank You page is not what i need. Sorry if I wasn't able to explain in an understandable way. I'll try again.

    The output of the PHP and javscript scripts are not for the user to see, they are for me to see. I receive an e-mail everytime a user fills this form including the whole form content, I need the output of my scripts (the content of the forementioned variables) to be included in this e-mail. I also need the output of my script to be stored in Jotform's database as if they were answers filled in a form. When I access the forms Submissions, I need all of that info to be in there, so I can export to an excel spreadsheet and run statistics.

    In other words, the form should have one field for each of the forementioned variable, the user runs the scripts before opening the form and when the form is opened, these fields should be prepopulated with the contents of the forementioned variables. However, this should be done in a way that the user cannot modify the prepopulated values. Even better if these fields are hidden and the user can't even see that this information was collected and sent to us (to avoid confusion for user that don't understand this kind of technical information).

    Thanks in advance

  • Profile Image
    Answered on February 26, 2013 at 08:03 PM


    I think I now get a grab of you what you wanted to do.

    Here are what you need.

    1. You will need to use the form's source code (guide: How-to-get-your-Form-Source-Code)

    2. You have to on #1 because you will need to pre-populate a hidden box in your form

    3. Since you can include the hidden box field in your email notification, you will now be able to capture the variables output into your email.

    Hope this help. Continue updating us if we can help you further.


  • Profile Image
    Answered on February 26, 2013 at 08:43 PM

    Hi Jonathan,

    Thanks, that is exactly what I need!

    1. I know how to use the form's source code.

    2. How do I prepopulate the hidden fields with the content of the PHP or javascript variables? Could you please provide instructions and/or sample code for both cases (PHP and javascript)?


  • Profile Image
    Answered on February 26, 2013 at 09:05 PM

    Hi Bruno,

    I am not much of a javascript or php programmer. BUT base on experience alone, I think I can help you with this.

    Give me some time while I check the scripts you provided already from your previous response.

    I will update you later once I have completed the web page with the form.

    Btw, the main thing here is, if you are able to generate already your variables output, you can simply pre-populate the hidden boxes on the form's submit event (i.e. for js, the "onclick" event of the submit button)

    For PHP sample, there is one already from this article -Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page  -- as you can see the textboxes are pre-populated after the 1st form was submitted.


  • Profile Image
    Answered on March 05, 2013 at 04:59 PM

    Hi jonathan,

    I sent the hidden field contents via URL parameters, that way I can update the form when needed without having to update the source code in our website.

    Thanks for your help

  • Profile Image
    Answered on March 05, 2013 at 05:19 PM

    Hi Bruno,

    "I sent the hidden field contents via URL parameters"

    I understand that this is the way it is. You can acctully see in the URL the value for the hidden field.

    Please correct me if I am wrong -- from what I gather, everything is working now on your project?


  • Profile Image
    Answered on March 07, 2013 at 04:39 AM

  • Profile Image
    Answered on July 04, 2013 at 10:32 PM

    We are happy to announce that we have released Jotform Webhooks,  this feature would replace Send Post Data + Custom URL Thank You Page workaround in order to help you transfer forms data to your own database using your own script codes.

    To know more about Jotform Webhooks, please click here.


    Thank you for using JotForm. :)