CodeIgniter form Verification Method Example, CodeIgniter form _php Tutorial

Source: Internet
Author: User
Tags form post getting started with php codeigniter

CodeIgniter form Verification Method example, CodeIgniter form


The example in this paper describes the CodeIgniter form verification method. Share to everyone for your reference, as follows:

1. Write a view file under the D:\CodeIgniter\system\application\views directory myform.php

My Form<?php echo $this->validation->error_string;? ><?php echo form_open (' Form/index ');? >

Username

Password

Password Confirm

Email Address

Then write a view file formsuccess.php

My Form

Your form was successfully submitted!

<?=anchor (' form ', ' Try it again! '); ?>

2. Write a controller file under the D:\CodeIgniter\system\application\controllers directory form.php

<?phpclass Form extends controller{function index () {$this->load->helper (array (' Form ', ' url ')); $this Load->library (' validation ');   $rules [' username '] = "required";    $rules [' password '] = "required";    $rules [' passconf '] = "required";    $rules [' email '] = "required";    $this->validation->set_rules ($rules);    $this->validation->set_error_delimiters (', '); $fields [' username '] = ' username '; $fields [' Password '] = ' Password '; $fields [' passconf '] = ' Password confirmation '; $fields [' email '] = ' email Address '; $this->validation->set_fields ($fields);   if ($this->validation->run () ==false) {   $this->load->view (' myview/myform ');   } else {   $this->load->view (' myview/formsuccess.php ');}}}   ? >

3.http://localhost:8888/index.php/form/index visit

Ok, the results are out.

More readers interested in PHP related content can view this site topic: "CodeIgniter Introductory Tutorial", "CI (codeigniter) Framework Advanced Tutorial", "PHP date and Time usage summary", "PHP object-oriented Programming introduction tutorial", "PHP string ( String) Usage summary, "Getting Started with Php+mysql database operation" and "PHP common database Operation Skills Summary"

I hope this article is helpful to you in PHP programming.

Articles you may be interested in:

    • CodeIgniter method for detecting form post data
    • CodeIgniter implementation of URL jumps after user login verification is processed
    • autoload.php Automatic load usage analysis of CodeIgniter configuration
    • Analysis of the business logic example of CodeIgniter controller
    • CodeIgniter Custom Controller My_controller usage Analysis
    • CodeIgniter Hook Usage Example detailed
    • Example analysis of database.php usage of codeigniter configuration
    • CodeIgniter Multi-language Implementation method detailed
    • CI (CodeIgniter) Model Usage Example analysis
    • Analysis of Third_party usage of CodeIgniter Auxiliary third-party class library
    • CodeIgniter Extending Core class examples
    • CodeIgniter View Usage Considerations
    • CodeIgniter Read and write separation implementation method detailed

http://www.bkjia.com/PHPjc/1106128.html www.bkjia.com true http://www.bkjia.com/PHPjc/1106128.html techarticle CodeIgniter Form Verification Method Example, CodeIgniter form This article describes the CodeIgniter form verification method. Share to everyone for your reference, as follows: 1. In D:\CodeIgni ...

  • 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.