title: 404 page not found CodeIgniter Login
body: <p>This is my first time using CodeIgniter and I am trying to create a Log In form. Whenever I click on the submit button that I have created, it brings me to a 404 Page Not Found Error.</p>
  
  <p>I have made a view_login.php in the view folder with this code:</p>
  
  <pre><code>&lt;?php echo form_open('user/login') ?&gt;
  &lt;ul&gt;
  &lt;li&gt;
  &lt;label&gt; username &lt;/label&gt;
  &lt;div&gt;
  &lt;?php echo form_input(array('id' =&gt; 'username', 'name' =&gt; 'username')); ?&gt;
  &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
  &lt;label&gt; password &lt;/label&gt;
  &lt;div&gt;
  &lt;?php echo form_password(array('id' =&gt; 'password', 'name' =&gt; 'password')); ?&gt;
  &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;?php echo validation_errors(); ?&gt;&lt;/li&gt;
  &lt;li&gt;
  &lt;?php echo form_submit(array('name' =&gt; 'submit'), 'login'); ?&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p></p>
  
  
  
  <p>This is my user.php controller:</p>
  
  <pre><code>&lt;?php
  class User extends CI_controller
  {
  
  public function __construct()
  {
      parent::__construct();
      $this-&gt;load-&gt;model('user_model');
  }
  
  
  public function register()
  {
  $this-&gt;load-&gt;library('form_validation');
  
  
  if($this-&gt;form_validation-&gt;run() == FALSE)
  {
      $this-&gt;load-&gt;view('templates/header', $data);   
      $this-&gt;load-&gt;view('user/view_register');
      $this-&gt;load-&gt;view('templates/footer');
  }
  
  else
  {
  echo 'this is being processed. thank you'; 
  }   
  
      $this-&gt;load-&gt;view('user/view_register');
  }   
  
  public function login()
  {
  $this-&gt;load-&gt;library('form_validation');
  
  $data['title'] = 'Log In';
  
   $this-&gt;load-&gt;view('user/view_login'); 
  
   if ($this-&gt;form_validation-&gt;run() == FALSE)
   { 
      $this-&gt;load-&gt;view('templates/header', $data);   
      $this-&gt;load-&gt;view('user/view_login');
      $this-&gt;load-&gt;view('templates/footer');
   {
   else
   {
       $user_id = $this-&gt;User_model-&gt;check_login($this-&gt;input-&gt;post('username',
                  $this-&gt;input-&gt;post('password');
  </code></pre>
  
  <p>Here is my User_model:</p>
  
  <pre><code>class User_model extends Model {
  
  function User_model()
  {
      parent::Model();
  }
  
  function check_login($username, $password)
  {
  
  $sha1_password = sha1($password);
  
  $query_str = "SELECT user_id FROM users WHERE username = ? and password = ?";
  
  $result = $this-&gt;db-&gt;query($query_str, array($username, $sha1_password));
  
  if ($result-&gt;num_rows() ==1)
  {
      return $result-&gt;row(0)-&gt;user_id;
  }
  else
  {
      return false;
  }
  </code></pre>
  
  <p>Any help would be immensely appreciated :) </p>