Welcome Guest, Not a member yet? Register   Sign In
testing input for email address
#1

[eluser]k7faq[/eluser]
still rather green around the edges with CI but learning as quick as possible. Any assistance is _greatly_ appreciated!

Have a form. Need to test in validation if the userName field has been populated by the visitor as an email address. (testing for other ways not necessary right now, i.e. meatnospamdotcom)
Testing the input to see if valid email address is what is catching me. I am using 'valid_email' for the actual email address field.

I am already performing a callback_, this would be an optimum area to handle this in...

snippets of code:

create_account(){
$this->form_validation>set_rules('userName','Username',
'callback__userName_check|trim|required|min_length[5]');
} // function create_account

function _username_check($userName) {
// verify user name not in use
$this->db->where('userName', $this->input->post('userName'));
$query = $this->db->get('users');

if($query->num_rows > 0){
$this->form_validation->set_message('_userName_check',
'Username already in use. Please select another.');
return FALSE;
} // if num_rows
} // function: _username_check


Messages In This Thread
testing input for email address - by El Forum - 10-03-2010, 04:19 PM
testing input for email address - by El Forum - 10-03-2010, 05:27 PM
testing input for email address - by El Forum - 10-03-2010, 05:38 PM
testing input for email address - by El Forum - 10-03-2010, 06:04 PM
testing input for email address - by El Forum - 10-03-2010, 06:07 PM
testing input for email address - by El Forum - 10-03-2010, 06:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB