Welcome Guest, Not a member yet? Register   Sign In
Not understanding form validation
#2

[eluser]JuanitoDelCielo[/eluser]
You should send it to to same controller and method over an over in order to get the errors

Code:
class User extends CI_Controller {

    public function insert() {

        $this->form_validation->set_rules('email', 'E-mail', 'required|trim');

        if ( $this->form_validation->run() ) {

            //Insert into the database
            //Succesful message

        } else {

            $this->load->view('newuserform');

        }

    }

}

View

Code:
<?php echo form_open('user/insert'); ?>
    <?php echo form_label('E-mail', 'email'); ?>
    <?php
        $input = array(
        'name'  => 'email',
        'class' => 'txt',
        'value' => set_value('email')
    );
        echo form_input($input);
    ?>
    <?php echo form_submit('', 'Create User',); ?>
<?php echo form_close(); ?>


Messages In This Thread
Not understanding form validation - by El Forum - 04-06-2011, 12:34 PM
Not understanding form validation - by El Forum - 04-06-2011, 01:52 PM
Not understanding form validation - by El Forum - 04-06-2011, 03:08 PM
Not understanding form validation - by El Forum - 04-07-2011, 12:59 AM
Not understanding form validation - by El Forum - 04-07-2011, 10:24 AM
Not understanding form validation - by El Forum - 04-07-2011, 10:44 AM
Not understanding form validation - by El Forum - 04-07-2011, 11:33 AM
Not understanding form validation - by El Forum - 04-07-2011, 12:43 PM
Not understanding form validation - by El Forum - 04-07-2011, 12:46 PM
Not understanding form validation - by El Forum - 04-07-2011, 01:47 PM
Not understanding form validation - by El Forum - 04-07-2011, 04:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB