title: Codeigniter form_validation library error
body: <p>I am newbie to Codeigniter and trying to build a login page from the tutorial <a href="http://www.codefactorycr.com/login-with-codeigniter-php.html" rel="nofollow">codeigniter login</a>. Now when I tried to login after entering my username and password, I am getting the following error.</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Notice</p>
    
    <p>Message: Undefined property: Verifylogin::$form_validation</p>
    
    <p>Filename: controllers/verifylogin.php</p>
    
    <p>Line Number: 18</p>
  </blockquote>
  
  <p>EDITED:</p>
  
  <p>my <code>verifylogin.php</code> file is</p>
  
  <pre><code>    &lt;?php
  
  /*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  class Verifylogin extends CI_Controller
  {
      function __construct() {
          parent::__construct();
      }
  
      function index()
      {
          $this-&gt;load-&gt;helper(array('form', 'url'));
          $this-&gt;load-&gt;model('user');
          $this-&gt;load-&gt;library('form_validation');
  
          //$this-&gt;load-&gt;library('form_validation', 'form_validation', true/false);
  
          $this-&gt;form_validation-&gt;set_rules('username','Username','trim|required|xss_clean');
          $this-&gt;form_validation-&gt;set_rules('password','Password','trim|required|xss_clean|callback_check_database');
  
          if($this-&gt;form_validation-&gt;run() == FALSE)
          {
              redirect('login','refresh');
          }
          else
          {
              redirect('home','refresh');
          }
      }
  
      function check_database($password)
      {
          $username = $this-&gt;input-&gt;post('username');
          $this-&gt;load-&gt;model('user');
          $result = $this-&gt;user-&gt;login($username,$password);
  
          if($result)
          {
              $sess_array = array();
              foreach($result as $row)
              {
                  $sess_array = array('id'=&gt;$row-&gt;id,'username'=&gt;$row-&gt;username);
  
                  $this-&gt;session-&gt;set_userdata('logged_in',$sess_array);
              }
              return TRUE;
          }
          else {
              $this-&gt;form_validation-&gt;set_message('check_database','Invalid username or password');
          }
      }
  }
  ?&gt;
  </code></pre>
  
  <p>Also where this <code>form_validation.php</code> file is located.</p>