I have a dashboard with users details which they can edit. I would like to add a password change but before they can change their password how would I validate their current password before letting them change to a new password?
So the form would have 3 fields. First field will have their current_password, follow by new_password and confirm_password.
codeigniter comes with a Form Validation Class you can find the documentation here.
Its purpose is exactly what its name suggest – It will help you validating your form input. Once you get used to it it comes in really handy.
This is how your controller could look:
This is not a perfect example for the form validation class. Just because you could easily validate those 3 fields without its help. But as its already built in with codeigniter why not use it?