We are very familiar with the feature in Prepopulating the fields to your Jotform via URL Parameters wherein the form always receives the parameter data. With this feature, form fields are automatically given default values when a URL address to the form with included parameters is clicked.
What if you wanted to send the parameter data instead? And the target page is not a Jotform form?
- Example A – you can simply send the data via the URL parameter as mentioned in the link first shared above, you can also check this link to a guide that allows you to send data to another URL by prepopulating the target URL parameter from the form fields of form #1.
- Example B – we want to send the form field data to a target PHP script via POST method, this will NOT append the data in the URL parameter, which makes this method more secure.
Being able to directly send the information from Jotform form into your own website or PHP script, provides a lot of flexibility in collecting data and as well as enhancing user’s experience since you are using your own custom web pages with JotForm.
This tutorial will show how to send submission data via POST method and using the “Thank You” settings.
This Jotform feature uses the POST request method which requires PHP scripts.
PHP is required to be supported and enabled on the web server of the custom page.
The tutorial is divided into 2 parts:
- Creating the Form
- Creating the Custom PHP Page
Part 1 – Creating the Form
- Login to Jotform and create the form in the form builder.
- To complete the form, enable the Send Post Data feature of the form.
Just click Settingsat the top > Form Settingson the left > click Show More Options > scroll down and look for the Send Post Dataoption > then select Yes.
- When satisfied with the form, use the Thank You wizard to add the URL address of the target PHP script.
To set this up, click Settingsat the top > Thank You Pageon the left > tick the Redirect to external linkoption > then paste the path to your PHP script.
Note: The URL address should be the PHP page that exists in your website (this is the page created in Part #2 of this tutorial)
- Preview and test the form.
Part 2 – Creating the Custom PHP Page
The URL entered in the Thank You wizard’s Redirect to external link should be able to fetch PHP tags.
- Start creating your PHP web page using your editor (any text editor will do).
- For the purpose of this tutorial, follow or copy the described PHP scripts found on this guide.
- Save the PHP page as redirect.php, or you can name it anything that you like, it should at least have an extension of .php as a file.
- Make sure it is deployed and located in your website with the correct URL address that was similarly used in step #3 in the Part 1 of this tutorial.
Example – the URL address provided in the form’s Thank You page in my case is:
- To fetch the data from the POST method. You need to know the correct PHP tags of your forms. You can get your fields PHP code by following this guide: How to Post Submission Data to Thank You Page.
Example is this form: https://www.jotform.com/63143715707960. The PHP code or tags for my fields are listed which are the following:
Now in your PHP script, you can simply use those to fetch the data and use it as your own.
It is quite necessary that you have knowledge with PHP on this case to fully utilize and implement this. I suggest checking the links below to help you get started.
Cases where you can implement this tutorial:
- You want to save the information submitted directly on your database. There’s a specific guide about this here: How to send submission data to your MySQL database using POST method and PHP.
- You want to pass data to another page or script, but you don’t want it to be populated in the URL itself.
- Pass data to a 3rd party application that accepts POST data.
I hope that helps. Feel free to comment below. If you have questions or concerns, or you can also open a new thread in our forum page.
Do you want to make a PHP form? Please have a look at the page referred.