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

[eluser]cominus[/eluser]
After installing form validation, I can still click the submit button on the form and continue to the next page successfully - no error messages, etc.

Here is the controller:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {

    function __construct()
    {
        parent::__construct();
        
    }

    function index()
    {
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->form_validation->set_rules('member_email','Your Email','required');
        $this->form_validation->set_rules('password','Password','required');
        
        $data['page_title'] = 'Login';
        $data['page_heading'] = 'Login to the Bomra';

        $this->load->view('header', $data);
        
        if ($this->form_validation->run() == FALSE)
        {
            $this->load->view('loginview', $data);
        }
        
        $this->load->view('footer');
    }

Here is the form view:
Code:
<div id="form_login">

    &lt;?php echo validation_errors();?&gt;
    
    &lt;?php echo form_open('login/loggedin'); ?&gt;
    &lt;?php echo form_fieldset('Login Form'); ?&gt;<br /><br />
    &lt;?php echo form_label('Member Email','member_email'); ?&gt;
        &lt;?php $email_data = array(
                        'name' => 'member_email',
                        'id' => 'member_email',
                        'value' => '',
                        'maxlength' => '60',
                        'size' => '30'
                        );
        echo form_input($email_data);
        ?&gt;<br /><br />
    &lt;?php echo form_label('Password','password'); ?&gt;
        &lt;?php $password_data = array(
                        'name' => 'password',
                        'id' => 'password',
                        'value' => '',
                        'maxlength' => '60',
                        'size' => '30'
                        );
        echo form_password($password_data);
        ?&gt;<center><br /><br />
    &lt;?php echo form_submit('loginsubmit','Submit Login'); ?&gt;
    <br /><br /></center>
    &lt;?php echo form_fieldset_close(); ?&gt;
    &lt;?php echo form_close(); ?&gt;

</div>

Here is the login page view:
Code:
<div id="content-1col">

    &lt;?php $this->load->view('form_login'); ?&gt;

</div>

There must be something missing, but I cannot see it. Thanks for looking at this.


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