title: form validation not working Codeigniter
body: <p>I think I am doing everything all right, but why isnt my validation working. Every time the else statement gets executed, even if I enter the valid data.</p>
  
  <pre><code>public function login ()
  {
      // Redirect a user if he's already logged in
      $dashboard = base_url().'dashboard';
      $this-&gt;user_model-&gt;loggedin() == FALSE || redirect($dashboard);
  
      // Set form
      $this-&gt;form_validation-&gt;set_rules('email','Email','required');
      $this-&gt;form_validation-&gt;set_rules('password','Password','required');
  
      // Process form
      if ($this-&gt;form_validation-&gt;run() == TRUE) {
  
          echo "Validation Success";
      }else{
  
          $this-&gt;session-&gt;set_flashdata('validation_errors', validation_errors().'&lt;p&gt;Please enter valid email and password&lt;/p&gt;' );
          redirect(base_url().'login', 'refresh');
  
      }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I am using  dreamhost VPS .</p>