CodeIgniter form verification

Source: Internet
Author: User
CodeIgniter form verification

To use CodeIgniter form verification, add:

?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 $ This-> load-> helper ('form'); $ this-> load-> library ('form _ validation '); // Set verification rules/* $ config = array ('field '=> 'Category', 'label' => 'Category name ', 'rules' => 'delimiter'), array ('field' => 'title', 'label' => 'title ', 'rules' => 'required'); $ this-> form_validation-> set_rules ($ config); */$ this-> form_validation-> set_rules ('Category ', 'Category name', 'required'); $ this-> form_validation-> set_rules ('title', 'title', 'required '); // matches is equal to another value. matches [title] // unique is_unique value is_unique [table. field] (table/field) // min_length min length min_length [6] // max_length Max length max_length [12] // valid_email verification email // valid_emails verifies multiple emails, separate // valid_ip verification IP // valid_base64 verification Base64 // alpha letter // alpha_numeric combination of letters and numbers // alpha_dash combination of letters, numbers, and underlines // numeric number or number string // integer // is_numeric numeric or numeric string // when multiple rules are used together, add | connect, for example: required | valid_email | is_unique [users. email] if ($ this-> form_validation-> run () = FALSE) {// execution upon verification failure} else {// execution upon verification success}

 

On the verification page:

?
123 Echovalidation_errors (); // display all error messages echoform_error ('title'); // display a single error message echoset_value ('title'); // Set the form value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.