title: CodeIgniter getting form field value to lowercase
body: <p>I have just started on learning how to use CodeIgniter and have never use any framework before so I only know a bit of how is the flow. Right now I have 1 issue that I want to set the input username to lowercase and I do not have any idea how to write the function for the convert_lowercase().</p>
  
  <p>Below is my code:</p>
  
  <pre><code>public function signup_validation()
      {
          $this -&gt;load-&gt;library('form_validation');
  
          $this-&gt;form_validation-&gt;set_rules('username', 'Username', 'required|trim|is_unique[userinfo.username]|convert_lowercase');
          $this-&gt;form_validation-&gt;set_rules('password', 'Password', 'required|trim');
          $this-&gt;form_validation-&gt;set_rules('cpassword', 'Confirm Password', 'required|trim|matches[password]');
  
          $this-&gt;form_validation-&gt;set_message('is_unique', 'That Username Already Exists.');
  
          if($this-&gt;form_validation-&gt;run()){
          }else{
              $this-&gt;load-&gt;view('signup');
          }
      }
  
  public function convert_lowercase()
      {
          strtolower($this-&gt;input-&gt;post('username'));
      }
  </code></pre>
  
  <p>I am not sure am I doing the right way.</p>
  
  <p>And is it best to just put the strtolower in the set_rules parameter? Or it is best to put in a function?</p>
  
  <p>And if separate it, how should it be done and how do I get the final username data to insert into database?</p>
  
  <p>Any kind souls out there can help me on this?</p>
  
  <p>Thanks in advance.</p>