Home > Software design >  Set rules method parameters in CodeIgniter
Set rules method parameters in CodeIgniter

Time:10-04

I am trying to validate the username in CodeIgniter using the form_validation library. What I found on the docs was $this->form_validation->set_rules('username', 'Username', 'required');. I'm wondering what are the parameters set in the set rules function? What are they, are they really necessary? I tried to look for the explanation somewhere but never found anything. Can anyone help me understand this?

CodePudding user response:

$this->form_validation->set_rules('username', 'Username', 'required'); 
  • First parameter is the name of the respective field .
  • Second parameter is the message to be displayed.
  • Third parameter is for condition for form validation.
  • Related