title: Admin login function in CodeIgniter PHP not working
body: <p>I tried to make a login function for admins so admins are able to login with using a login form, but its not working. When I click on the login button nothing happens... both when I use the right admin email and password and a wrong input..</p>
  
  <p>This is my adminlogin function in my Auth controller:</p>
  
  <pre><code>public function adminlogin() 
      {
          $this-&gt;form_validation-&gt;set_rules('admin_email', 'Admin_email', 'required');
              $this-&gt;form_validation-&gt;set_rules('wachtwoord', 'Wachtwoord', 'required|min_length[5]');
              if ($this-&gt;form_validation-&gt;run() == TRUE) {
  
          $admin_email = $_POST['admin_email'];
          $admin_wachtwoord = ($_POST['admin_wachtwoord']);
  
           //check admin in database
          $this-&gt;db-&gt;select('*');
          $this-&gt;db-&gt;from('admin');
          $this-&gt;db-&gt;where(array('admin_email'=&gt;$admin_email, 'admin_wachtwoord' =&gt; $admin_wachtwoord));
          $query = $this-&gt;db-&gt;get();
          $admin = $query-&gt;row();
  
  
          if($admin-&gt;admin_email) {
  
              $this-&gt;session-&gt;set_flashdata("success","U bent nu ingelogd als admin");
  
          //admin sessios
          $_SESSION['admin_logged'] = TRUE;
          $_SESSION['admin_id'] = $admin-&gt;admin_id;
          $_SESSION['admin_email'] = $admin-&gt;admin_email;
          $_SESSION['admin_wachtwoord'] = $admin-&gt;admin_wachtwoord;
  
           //link to admin dashboard
          redirect("IndexController", "refresh");
          } else {
  
              $this-&gt;session-&gt;set_flashdata('error','Invalid email or password');
              //if admin doesn't exists reload the admin login form
              redirect("https://kadokado-ferran10.c9users.io/auth/adminlogin" , "refresh");
          }
  
          }
            //laad alle adminlogin views
      $this-&gt;load-&gt;view('templates/header');
      $this-&gt;load-&gt;view('adminviews/adminlogin');
      $this-&gt;load-&gt;view('templates/footer');
  }
  </code></pre>
  
  <p>My adminlogin.php view page in my adminviews folder:</p>
  
  <pre><code>&lt;div class="all-content"&gt; 
  
   &lt;div class="row"&gt;
          &lt;div class="col-lg-12 bg-warning" style="font-size:25px"&gt;
              &lt;center&gt;Admin login&lt;/center&gt;
          &lt;/div&gt;
          &lt;/div&gt;
  
  &lt;br&gt;
  
    &lt;section&gt;
    &lt;div&gt;
      &lt;div class="row"&gt;
        &lt;div class="col-sm-12"&gt;
          &lt;div class="row"&gt;
            &lt;div class="col-sm-4 col-sm-offset-4"&gt;
  
              &lt;form action="" method="POST"&gt;
  
                &lt;div class="form-group"&gt;
  
                      &lt;label for="name" class="control-label"&gt;Email&lt;/label&gt;
  
  
                      &lt;input class="form-control" name="admin_email" id="admin_email" type="email" placeholder="E-mail"&gt;
  
              &lt;/div&gt;
  
                &lt;div class="form-group"&gt;
  
                      &lt;label for="message" class="control-label"&gt;Wachtwoord&lt;/label&gt;
  
                      &lt;input class="form-control" name="admin_wachtwoord" id="admin_wachtwoord" type="password" placeholder="Wachtwoord"&gt;
  
              &lt;/div&gt;
                   &lt;div class="form-group"&gt;
  
                      &lt;input name="adminlogin" type="submit" class="btn btn-primary" value="Inloggen" /&gt;
  
              &lt;/div&gt;
  
                &lt;/div&gt;
  
              &lt;/form&gt;
  
            &lt;/div&gt;
  
          &lt;/div&gt;
  
        &lt;/div&gt;
  
      &lt;/div&gt;
  
    &lt;/div&gt;
  
  &lt;/section&gt;
  
  
  &lt;/div&gt;
  &lt;div class="clearfix"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>DATABASE info:</p>
  
  <pre><code>table: admin
  1. admin_id = primary key
  2. admin_email
  3. admin_wachtwoord
  </code></pre>