[eluser]ryeguy[/eluser]
I want to call validate_username but php says the function is undefined. Do I have to use a helper file to use internal functions or something?
Please ignore the actual code this is my first time using CI I am just figuring out how everything works.
Code:
<?php
class User extends Controller
{
function add($username, $password)
{
$this->load->library('form_validation');
$data['variables'] = array("username" => $username,
"password" => hash("sha256", $password),
"user_valid" => validate_username($username));
$this->load->view('output', $data);
}
function validate_username($username)
{
return
$this->form_validation->min_length($username,4) &&
$this->form_validation->max_length($username,15) &&
$this->form_validation->alpha_numeric($username) &&
is_string($username[0]);// && //make sure the first character is not a number
}
}
/* End of file user.php */
/* Location: ./system/application/controllers/user.php */