title: Codeigniter form URI loses segment when failing validation
body: <p>Using codeigniter 2.1.2, I have a form view loaded through a controller that takes a parameter. This parameter is a boolean that tells the view whether to render certain content on the form. </p>
  
  <p>the URI of the standard form is: <code>ordering/create/</code>
  but if the form should be rendering as a 'holiday' form is: <code>ordering/create/holiday</code></p>
  
  <p>If the submitted form does not pass validation, the standard form is always shown. How do I get the last segment to persist through validation and form re-population?</p>
  
  <p>Here is my controller function.</p>
  
  <pre><code>public function create($holiday = NULL)
  {
      $data['holiday'] = ($holiday != NULL) ? TRUE : FALSE;
  
      //load the code igniter helpers we'll be using
      $this-&gt;load-&gt;helper('form');
      $this-&gt;load-&gt;library('form_validation');
  
      //set the page title
      $data['title'] = 'Create an Order';
  
      //validate the form input
      $this-&gt;form_validation-&gt;set_rules('firstName','First Name','required');
      $this-&gt;form_validation-&gt;set_rules('lastName','Last Name','required');
      $this-&gt;form_validation-&gt;set_rules('phoneNumber','Phone Number','required|callback_validate_phoneNumber');
      $this-&gt;form_validation-&gt;set_rules('emailAddress','Email Address','required|valid_email');               
      $this-&gt;form_validation-&gt;set_rules('pickupDate','Pickup Date','required|callback_validate_pickupDate');
      $this-&gt;form_validation-&gt;set_rules('pickupTime','Pickup Time','required');
  
      //check that at least one product was selected
      $this-&gt;load-&gt;model('products_model');
      $data['products'] = $this-&gt;products_model-&gt;get_online_products($data['holiday']);
      $productSelections = array();
      $totalProducts = 0;
      foreach($data['products']-&gt;result() as $product)
      {
          $productSelections[$product-&gt;productProductSizeId] = $this-&gt;input-&gt;post('product_'.$product-&gt;productProductSizeId);
          $totalProducts += $productSelections[$product-&gt;productProductSizeId];
      }
  
      $pickupDate = new DateTime($this-&gt;input-&gt;post('pickupDate'));
  
      //if the form failed validation, or there is no form data yet, send the user back to the form
      if($this-&gt;form_validation-&gt;run() === FALSE || $totalProducts == 0)
      {
          $this-&gt;load-&gt;model('calendar_model');
          $data['calendarRules'] = $this-&gt;calendar_model-&gt;get_rules($data['holiday']);
  
          $data['productSelections'] = $productSelections;
  
          if($this-&gt;form_validation-&gt;run() === TRUE &amp;&amp; $totalProducts == 0)
          {
              $data['productsError'] = 'You must order at least one product';
          }
  
          $this-&gt;load-&gt;view('templates/header', $data);
          $this-&gt;load-&gt;view('ordering/create', $data);
          $this-&gt;load-&gt;view('templates/footer');
      }
      else
      {
          //save the data to the DB
          $savedData = $this-&gt;ordering_model-&gt;create_order($data['holiday']);
  
          //send the confirmation email and redirect to the confirmation page
          $this-&gt;send_confirmation($savedData['orderHeader']['orderId']);
      }
  }
  </code></pre>