Form validation don't work |
Hi this is my form user/register :
Code: <!DOCTYPE html> This is my controller function : Code: function register(){ But if i insert email and password i have this error : The Password field is required. if i insert password and password_repeat to i have this error : The Password Confirmation field is required. this is a test application : http://lemuria.altervista.org/user_codei...r/register
Your form has two input fields with the name 'password'. If your form is posted, and the second field with the name 'password' is empty, form validation will come up with an error message. You should rename the second field to 'repeat_password'.
And (less important, but I need to mention it), your form is being closed twice.
As Wouter60 pointed out, both fields are named password
Code: <input name="password" value="" id="password_id" type="text"> Both fields also have the same ID. ID's in HTML must always be unique. Besides being required, repeat password should also be set to match the password field Code: <input name="password" value="" id="password_id" type="text"> And set your rules like this PHP Code: $this->form_validation->set_rules('password', 'Password', 'required'); Example from documentation https://www.codeigniter.com/user_guide/l...ding-rules |
Welcome Guest, Not a member yet? Register Sign In |