title: How to set segment to view in codeigniter after form validation?
body: <p>I am validating a form on many view that are generated by the third URL segment.   </p>
  
  <p>The URL: <a href="http://example.com/listings/item/12" rel="nofollow">http://example.com/listings/item/12</a> (<em>The 12 will change based on item</em>)</p>
  
  <p>Both my functions are below, <strong>my question is, when the validation fails how to I refresh the page with the 3rd segment and show the validation errors?</strong></p>
  
  <p>P.S: I have already tried redirect() but the validation errors don't remain.</p>
  
  <p>Thank You.</p>
  
  <hr>
  
  <p>This is the "item" function </p>
  
  <pre><code>    public function item()
  {
  
      if ($this-&gt;session-&gt;userdata('is_logged_in'))
      {
          $id = $this-&gt;uri-&gt;segment(3);
          $this-&gt;load-&gt;model('listings_model');
  
          if ($data['things']= $this-&gt;listings_model-&gt;get_item($id))
          {
              $this-&gt;load-&gt;view('list/item_view',$data);
          }
      }
      else
      {
           $this-&gt;unauth();
      }
  }
  </code></pre>
  
  <p><hr>
  This is my validations </p>
  
  <pre><code>    public function get_email()
  {
  
      $this-&gt;load-&gt;library('form_validation');
  
  
          $this-&gt;form_validation-&gt;set_rules('captcha', 'Captcha', 'required|trim|callback_check_captcha' );
  
  
          if ($this-&gt;form_validation-&gt;run() == FALSE)
          {
             $this-&gt;item();
          }
          else
          {
              $this-&gt;load-&gt;model('listings_model');
  
              if ($this-&gt;listings_model-&gt;update_listing())
              {
                  echo "Good";
              }
  
          }
  }
  </code></pre>