Validating user input with the form validation library PHP CodeIgniter


show more Validating user input with the form validation library provides you with in-depth training on Developer. Taught by Jon Peck as part of the Up and Running with PHP CodeIgniter show less
please wait ...

Validating user input with the form validation library

Now that the two views of the controller have been set up, I now have something that I can use the Form Validation Library with. Here's the control flow at a high level. First, I'll load the form_validation library. Then, I'll set the validation rules for each form element. When that's complete, I'll execute the validator to see if it passed or not. With that answer, the application can decide what to do based on validation success. I'm going to get started by returning to the IDE. I'll open the magazine controller, and navigate to right before the view is displayed.

I'll start by loading the form validation library. So, this, load, library, with a name, form, underscore, validation. Next I'll call a method called set rules. Set rules takes an array of arrays that contain three key value pairs. The field which is the form fields name, a label which is a human readable label that will be shown on failures and rules. A string containing the names of form validation...

Validating user input with the form validation library
Video duration: 6m 56s 1h 30m Intermediate

Viewers:

Validating user input with the form validation library provides you with in-depth training on Developer. Taught by Jon Peck as part of the Up and Running with PHP CodeIgniter

Subject:
Developer
Software:
PHP CodeIgniter
Author:
please wait ...