Welcome Guest, Not a member yet? Register   Sign In
SOLVED - Validation Error while Reproducing form...
#1

[eluser]The Wizard[/eluser]
Hello FriendsSmile

ive a error in this file:

Code:
<?php


$this->load->library('validation');

?>


<html>
<head>
<title>Register</title>
</head>
<body>

<?php echo $this->validation->error_string; ?>

<?php echo form_open('user/register'); ?>

<h5>Username</h5>
&lt;input type="text" name="username" value="&lt;?php echo $this-&gt;validation-&gt;username;?&gt;" size="50" />


<h5>Password</h5>
&lt;input type="text" name="password" value="" size="50" /&gt;

<h5>Password Confirm</h5>
&lt;input type="text" name="passconf" value="" size="50" /&gt;

<h5>Email Address</h5>
&lt;input type="text" name="email" value="" size="50" /&gt;

<div>&lt;input type="submit" value="Submit" /&gt;&lt;/div>

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;

it says:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Validation::$username

Filename: views/register_new.php

Line Number: 25
" size="50" />



and the controller looks like:
Code:
&lt;?php


class User extends Controller
{

    function __construct()
    {
        parent::Controller();
        
        /* load template parser */
        $this->load->library( 'parser' );
        $this->load->model ( 'User_model' );
        
        $this->load->database();
        
    }
    
    function register_process( $data )
    {
        
        /* add additional data, or form the data like you want. */
        $data['status']        = "Pending";
        $data['activation']    = 31337 + rand( 0, 666666999);
        
        $this->load->helper('date');
        $data['datetime']    = mdate( "%Y-%m-%d %H:%i:%s" );

        $result_register = $this->User_model->User_Register( $data );
        
        return $result_register;
        
    }
    
    function register ()
    {
        
        $this->load->helper( 'form' );
        $this->load->helper( 'url' );
        
        $this->load->library('validation');

        /* by default the error messages are displayed in <p> tags. */        
        //$this->validation->set_error_delimiters('<div class="error">', '</div>');
            
        //$rules['username']    = "callback_database_check";
        $rules['username']     = "required|min_length[5]|max_length[12]|callback_check_username";
        $rules['password']     = "required|matches[passconf]";
        $rules['passconf']     = "required";
        $rules['email']     = "required|valid_email||callback_check_email";
        $this->validation->set_rules($rules);
        
        $check_rules = $this->validation->run();

        if (  ($check_rules == false) )
        {
            $this->load->view('register_new.php');            
        }
        else
        {
            $data['username']    = $this->input->post ('username');
            $data['password']    = $this->input->post ('password');
            $data['email']        = $this->input->post ('email');
            
            $status = $this->register_process( $data );
            
            $status_info = $status['status'];
            
            if ( $status_info == 'Success' )
            {
                
                $fields['username'] = 'Username';
                $fields['password'] = 'Password';
                $fields['passconf'] = 'Password Confirmation';
                $fields['email'] = 'Email Address';
                
                $this->validation->set_fields($fields);
                
                $this->load->view('register_success.php');    
            }
            elseif ( $status_info == 'Error' )
            {
                
            }
                        
        }    
        
    }

    function check_username( $data )
    {
        if ( $this->User_model->User_Check( $data, 'username') == true )
        {
            $this->validation->set_message('check_username', "The Username: '$data' is allready taken, please chose another one.");
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }
    
    function check_email( $data )
    {
        if ( $this->User_model->User_Check( $data, 'email') == true )
        {
            $this->validation->set_message('check_email', "The Email address '$data' has been used to sign-up before. ");
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }

}


?&gt;


Does anyone have a solution?


Messages In This Thread
SOLVED - Validation Error while Reproducing form... - by El Forum - 08-05-2008, 01:30 PM
SOLVED - Validation Error while Reproducing form... - by El Forum - 08-05-2008, 02:06 PM
SOLVED - Validation Error while Reproducing form... - by El Forum - 08-05-2008, 03:03 PM
SOLVED - Validation Error while Reproducing form... - by El Forum - 08-05-2008, 03:12 PM
SOLVED - Validation Error while Reproducing form... - by El Forum - 08-06-2008, 02:01 AM
SOLVED - Validation Error while Reproducing form... - by El Forum - 08-06-2008, 02:02 AM
SOLVED - Validation Error while Reproducing form... - by El Forum - 08-08-2008, 10:59 AM
SOLVED - Validation Error while Reproducing form... - by El Forum - 08-08-2008, 11:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB