Validating form data php
Code Igniter offers several helper functions that permit you to do this.
The one you will use most commonly is: The validation system supports callbacks to your own validation methods.
PHP is a great scripting language that allows many dynamic functions in your site.
You can create custom contact forms, form validation, and email responses using PHP.
In that file you will place an array named $config with your rules.
As shown earlier, the validation array will have this prototype: In order to organize your rules into “sets” requires that you place them into “sub arrays”.
You can see that the form field data was passed to your callback method for you to process.
If you use this approach, you must name your array keys as indicated: Give it a try!If you need to receive an extra parameter in your callback method, just add it normally after the method name between square brackets, as in: Note You can also process the form data that is passed to your callback and return it.If your callback returns anything other than a boolean TRUE/FALSE it is assumed that the data is your newly processed form data. This is just an example of course, and callbacks aren’t limited to models.Form validation, while simple to create, is generally very messy and tedious to implement.If you submit the form you should simply see the form reload.