HTML and CSS Reference
In-Depth Information
Figure 8-4. The database tables viewed in phpMyAdmin
Handling Form Submissions
One of the major components of any app is the manner in which it accepts form submissions. In order to maximize
the efficiency of your app, it's worth taking some time to plan how all form submissions should be structured,
sanitized, processed, and stored.
Planning the Form Submission Workflow
First, we need to establish the form submission workflow:
1.
The user submits a form to the appropriate controller, which is determined by the form's
action attribute.
2.
The controller recognizes a form submission and checks for a valid action.
3.
If a valid action is found, the submission is checked for legitimacy using a nonce.
4.
Valid submissions are sent to the method specified by the action.
5.
The handler method processes data, hands it to the model for storage, and returns a
Boolean flag to indicate success or failure.
6.
The user is redirected to the proper page (or, in many cases, the page simply updates with
the new data).
Given this workflow, you can now start to flesh out the different steps of the form submission process.
 
Search WWH ::




Custom Search