[eluser]rajend3[/eluser]
I have two methods that use the same validation but 1 of them uses a subset of the inputs and rules.
So I have a $config variable in my user_controller class so if the validation changes I don't have to change them in two places.
Code:
private $userInputConfig = array(
array(
"field" => "fullName",
"label" => "Full Name",
"rules" => "required"
),
array(
"field" => "address",
"label" => "Address",
"rules" => "required"
),
array(
"field" => "email",
"label" => "Email",
"rules" => "required|valid_email"
),
array(
"field" => "password",
"label" => "Password",
"rules" => "required|min_length[8]"
)
);
My first method calls
Code:
$this->form_validation->set_rules(array_slice($userInputConfig,0,2));
and my second one calls
Code:
$this->form_validation->set_rules($userInputConfig);
I get an error saying
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined variable: userInputConfig
Filename: controllers/user_controller.php
Line Number: 42
Any ideas of how I can fix this?