ft_api_process_form
API
Overview
The simplest way to store form submission data is by submitting your form to process.php; the information is stored, the user is redirect to some sort of "thank you"page and everyone gets on with their life. This method, though the simplest, doesn't allow for more complicated scenarios, such as:
- You want to add server-side validation to ensure the information is valid before adding to the database.
- You have a multi-page form and need to submit the data only on the very last step.
- You have a multi-page form and need to store the data page-by-page as the user progresses through the form.
- You want to submit the information, but don't want it to appear in the Form Tools UI until a later date.
Enter the API. The API comes with a number of functions designed to let you submit the information via PHP code, rather than through the more restrictive process.php POST script. The most important of these functions is the ft_api_process_form() function. For those of you familiar with earlier version of Form Tools, this function replaces the older process_form() function used for "code" submission types, and was found in the (now deprecated) process_code.php file.
Fundamentally, Form Tools doesn't care HOW the information gets into the database. What's important is that it gets there.
Finalizing submissions
Every form submissions in the Form Tools database has a finalized flag: "yes" or "no". By default, submissions sent via process.php are set to finalized. Submissions sent via ft_api_process_form() are NOT finalized. Only finalized submissions appear in Form Tools.
Related Links
To understand the ft_api_process_form() function the best, we suggest you give one of the following tutorials a read.
Parameter keys
For completion, here's all the values that may be passed via the single parameter (a hash). But we strongly suggest giving one of the above tutorials a read first, otherwise this won't make all that much sense.
1. Required keys
2. Optional keys