title: Codeigniter form fields gets re-populated with prior data even after success
body: <p>When the form has incorrect or insufficient data, it shows validation error along with the form fields populated with past data. But even if the from is complete and correctly submitted, it is showing the submitted values in form fields. How to solve the problem?</p>
  
  <p>I am working out for comment form. Here is my controller function:</p>
  
  <pre><code>    public function index($id, $slug){
          // Fetch the article
          $this-&gt;article_m-&gt;set_published();
          $this-&gt;data['article'] = $this-&gt;article_m-&gt;get($id);        
          // Return 404 if not found
          count($this-&gt;data['article']) || show_404(uri_string());        
          // Redirect if slug was incorrect
          $requested_slug = $this-&gt;uri-&gt;segment(3);
          $set_slug = $this-&gt;data['article']-&gt;slug;
          if ($requested_slug != $set_slug) {
              redirect('article/' . $this-&gt;data['article']-&gt;id . '/' . $this-&gt;data['article']-&gt;slug, 'location', '301');
          }
  $c_rules = $this-&gt;article_comment_m-&gt;c_rules; 
  $this-&gt;form_validation-&gt;set_rules($c_rules);
  
          // Process the form
          if ($this-&gt;form_validation-&gt;run() == TRUE) {
  
              $data = array(
                  'article_id'=&gt;$this-&gt;input-&gt;post('article_id'),
  
                  'name'=&gt;$this-&gt;input-&gt;post('name'), 
                  'email'=&gt;$this-&gt;input-&gt;post('email'), 
             'website'=&gt;$this-&gt;input-&gt;post('website'), 
  
                'comment'=&gt;$this-&gt;input-&gt;post('comment'),
                'posted'=&gt;date('Y-m-d')
              );
  
              $this-&gt;article_comment_m-&gt;save_comment($data);
  
  
          }
  
          // Load view
  add_meta_title($this-&gt;data['article']-&gt;title);
          $this-&gt;data['subview'] = 'article';
          $this-&gt;load-&gt;view('_main_layout', $this-&gt;data);
  
      }    
  </code></pre>
  
  <p>And my view file has following data:</p>
  
  <pre><code>     &lt;?php echo validation_errors(); ?&gt;
  &lt;?php echo form_open(); ?&gt;
  &lt;?=form_hidden('article_id', uri_string());?&gt;
  &lt;table class="table"&gt;
  &lt;tr&gt;
      &lt;td&gt;Name:&lt;/td&gt;
      &lt;td&gt;&lt;?php echo form_input('name', set_value('name')); ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Email:&lt;/td&gt;
      &lt;td&gt;&lt;?php echo form_input('email', set_value('email')); ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
  &lt;td&gt;Website:&lt;/td&gt;
      &lt;td&gt;&lt;?php echo form_input('website', set_value('website')); ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
  &lt;tr&gt;
  &lt;td&gt;Comment:&lt;/td&gt;
  &lt;td&gt;&lt;?php echo form_textarea('comment', set_value('comment')); ?&gt;&lt;/td&gt;
     &lt;/tr&gt;
  
    &lt;tr&gt;
  
      &lt;td&gt;&lt;?php echo form_submit('submit', 'Submit', 'class="btn btn-primary"'); ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;?php echo form_close();?&gt;
  </code></pre>