title: Update user detail in Codeigniter
body: <p>I have written code by own knowledge for update user details using Codeignitor but nothing happen when i click update button user account page. Can anyone help me to find the problem and solution to solve by using folowing below my code:</p>
  
  <p>Controller:</p>
  
  <pre><code>public function update_userdetail() {
      // Load form helper and validation library
      $this-&gt;load-&gt;helper('form');
      $this-&gt;load-&gt;library('form_validation');
      // Update field validation
      $this-&gt;form_validation-&gt;set_rules('username', 'Username', 'trim|required|min_length[4]|is_unique[users.username]', array('is_unique' =&gt; 'This username already exists.'));
      $this-&gt;form_validation-&gt;set_rules('email', 'Email', 'trim|required|valid_email|is_unique[users.email]', array('is_unique' =&gt; 'This email already exists.'));
      if($this-&gt;form_validation-&gt;run() == false) {
          redirect('user/account');
      } else {
          // Set variable from Form
          $user_id    =   $this-&gt;input-&gt;post('user_id');
          $username   =   $this-&gt;input-&gt;post('username');
          $email      =   $this-&gt;input-&gt;post('email');
          if($this-&gt;user_model-&gt;update_user($user_id, $username, $email)) {
              $this-&gt;session-&gt;set_flashdata('notice','&lt;div class="success"&gt;Your details updated Successfully!&lt;/div&gt;');
              redirect('user/account');
          } else {    
              $this-&gt;session-&gt;set_flashdata('msg', '&lt;div class="error"&gt;Problem with update your detail!&lt;/div&gt;');
              redirect('user/account');
          }
      }
  }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>public function update_user($username, $email, $user_id) {  
          $data = array (
              'username'   =&gt; $username,
              'email'      =&gt; $email,
              'updated_at' =&gt; date('Y-m-j H:i:s'),
          );
          $this-&gt;db-&gt;where('id', $user_id);
          $this-&gt;db-&gt;update('users', $data);
          return; 
      }
  </code></pre>
  
  <p>Form:</p>
  
  <pre><code>&lt;?php 
      $username   = ($this-&gt;session-&gt;userdata['username']);
      $email      = ($this-&gt;session-&gt;userdata['email']);
      $user_id    = ($this-&gt;session-&gt;userdata['user_id']);
      ?&gt;
      &lt;h3&gt;Update detail&lt;/h3&gt;
      &lt;?php echo $this-&gt;session-&gt;flashdata('msg'); ?&gt;
      &lt;?php echo form_open(); ?&gt;
      &lt;input type="text" id="user_id" name="user_id" value="&lt;?php echo $user_id; ?&gt;"&gt;
      &lt;div&gt;
      &lt;input type="text" id="username" name="username" placeholder="Username" value="&lt;?php echo $username; ?&gt;"&gt;
      &lt;small class="error-text"&gt;&lt;?php echo form_error('username'); ?&gt;&lt;/small&gt;
      &lt;/div&gt; 
      &lt;div&gt;
      &lt;input type="email" id="email" name="email" placeholder="Enter your email" value="&lt;?php echo $email; ?&gt;"&gt;
      &lt;small class="error-text"&gt;&lt;?php echo form_error('email'); ?&gt;&lt;/small&gt;
      &lt;/div&gt;
      &lt;div&gt;&lt;?php echo form_submit('submit', 'Submit'); ?&gt;&lt;/div&gt;
      &lt;?php echo form_close(); ?&gt;
  </code></pre>