title: Codeigniter Form Validation Rule for match (password)
body: <p>I am trying to write Form validation rules in my Controller to submit Change Password form in which I am checking the old password too. I am getting the old password(current) from db and placing it in a hidden input field. </p>
  
  <p>My Rules are simple and are given below</p>
  
  <pre><code>         $config=array(
              array(
                  'field'   =&gt; 'old_password',
                  'label'   =&gt; 'oldpass',
                  'rules'   =&gt; 'trim|required'
              ),
              array(
                  'field'   =&gt; 'conf_password',
                  'label'   =&gt; 'connewpass',
                  'rules'   =&gt; 'trim|required|matches[password]'
              ),
              array(
                  'field'   =&gt; 'password',
                  'label'   =&gt; 'newpass',
                  'rules'   =&gt; 'trim|required'
              )
  </code></pre>
  
  <p>My hidden input field in the form to save current password is like </p>
  
  <pre><code>&lt;input type="hidden" name="old_pass" value="&lt;?php echo $user['password']?&gt;"&gt;
  </code></pre>
  
  <p>I know that matches(field name) in rules work for matching two field values but Where I am stuck is that the password coming from db is md5 encrypted. How can I encrypt the password coming from form and match with old pass field in the rule? </p>