title: Object not found! in Codeigniter Login
body: <p>I'm new to Codeigniter and I'm trying to build a login form by following some tutorials. However, when I try to submit the login form in order to validate the credentials that have been inputted by calling the validate_login function in the login controller , I get the "Object not Found" Error. Every time I click my submit button, my URL redirects to "<a href="http://localhost/pgevCI/login/validate_login" rel="nofollow noreferrer">http://localhost/pgevCI/login/validate_login</a>", but it still gets the Object not Found error.</p>
  
  <p>Controller: login.php</p>
  
  <pre><code>&lt;?php
  
  class Login extends CI_Controller {
  
      function index()
      {
          $data['main_content'] = 'view_login';
          $this-&gt;load-&gt;view('includes/login_template', $data);    
      }
  function validate_login()
      {
          $this-&gt;load-&gt;model('model_accounts');
          $valid = $this-&gt;model_accounts-&gt;validate();
  
          if($valid)
          {
              $data = array(
                  'userid' =&gt; $this-&gt;input-&gt;post('userid'),
                  'is_logged_in' =&gt; true
              );
  
              $this-&gt;session-&gt;set_userdata($data); 
              redirect('site/admin');
          }
  
          else
          {
              $this-&gt;index();
          }       
        }
      }
  </code></pre>
  
  <p>View form: view_login.php</p>
  
  <pre><code>&lt;form action="&lt;?php echo base_url(); ?&gt;login/validate_login" method="POST"&gt;
      &lt;div class="row"&gt;
        &lt;div class="col-lg-6"&gt;
          &lt;div class="form-group"&gt;
            &lt;input type="text" name="userid" class="form-control" id="user-name" aria-label="..." placeholder="Enter your username"&gt;
          &lt;/div&gt;&lt;!-- /input-group --&gt;
        &lt;/div&gt;&lt;!-- /.col-lg-6 --&gt;
  
        &lt;div class="col-lg-6"&gt;
          &lt;div class="form-group"&gt;
            &lt;input type="password" name="password" class="form-control" id="user-password" aria-label="..." placeholder="Enter your password"&gt;
          &lt;/div&gt;&lt;!-- /input-group --&gt;
        &lt;/div&gt;&lt;!-- /.col-lg-6 --&gt;
      &lt;/div&gt;&lt;!-- /.row --&gt;
  
      &lt;/br&gt;
      &lt;/br&gt;
      &lt;!-- Standard button --&gt;
      &lt;div class="action-buttons text-center"&gt;
  
        &lt;button type="submit" class="btn btn-custom"&gt;Sign In&lt;/button&gt;
  
        &lt;button type="button" class="btn btn-custom"&gt;Forgot your password?&lt;/button&gt;
  
      &lt;/div&gt;
    &lt;/form&gt;
  </code></pre>
  
  <p>Model: model_accounts.php
          
  
  <pre><code>class Model_accounts extends CI_Model {
  
      function validate() 
      {
  
          $this-&gt;db-&gt;where('userid', $this-&gt;input-&gt;post('userid'));
          $this-&gt;db-&gt;where('password', md5($this-&gt;input-&gt;post('password')));
          $query = $this-&gt;db-&gt;get('users');
  
          if($query-&gt;num_rows == 1)
          {
  
              return true;    
          }
      }
  }
  </code></pre>
  
  <p>Base URL &amp; Index File : </p>
  
  <pre><code>$config['base_url'] = 'http://localhost/pgevCI/';
  $config['index_page'] = 'index.php';
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wGADG.png" rel="nofollow noreferrer">Error Page</a></p>
  
  <p>Any help would really be appreciated! :)</p>