[eluser]Unknown[/eluser]
please help me on form validation if anything error here...
Code:
<?php
class Users extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('users_model', 'umodel');
$this->load->library('form_validation');
}
function users_register()
{
if(isset($_POST['btn_sub'])) {
$config = array(
array(
'field' => 'mobile_number',
'label' => '"Mobile Number"',
'rules' => 'required|numeric|min_length[4]|max_length[10]'
),
array(
'field' => 'zipcode',
'label' => '"Zipcode"',
'rules' => 'required|numeric|min_length[4]|max_length[10]'
)
);
$this->form_validation->set_rules($config);
if($this->form_validaiton->run() == TRUE) {
echo 'Valid';
} else {
echo 'Invalid';
}
}
}
}
giving the error
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Users::$form_validaiton
Filename: controllers/users.php
Fatal error: Call to a member function run() on a non-object in D:\wamp\www\demos\newmobilemongo\application\controllers\users.php on line 50
how to solve this?