title: Laravel 4, ->withInput(); = Undefined offset: 0
body: <p>I have had a lengthy search both here and the Laravel forums, but i can't find an answer to this problem. <code>-&gt;withInput()</code> coughs up an <code>Undefined offset: 0</code>.</p>
  
  <p>For Context:</p>
  
  <p>Controller</p>
  
  <pre><code>public function getJobs()
  
          {
              $position_options = DB::table('jposition')-&gt;lists('friendly','id');
              $category_options = DB::table('jcategory')-&gt;lists('friendly','id');
              $location_options = DB::table('jlocation')-&gt;lists('friendly','id');
  
  
  
              $result = $query-&gt;get();
              return View::make('jobsearch.search', array('position_options' =&gt; $position_options, 'category_options' =&gt; $category_options, 'location_options' =&gt; $location_options))-&gt;withInput();
  
          }
  </code></pre>
  
  <p>View</p>
  
  <pre><code>&lt;form action="{{ action('JobsearchController@getJobs') }}" method="post"&gt;
    &lt;div class="row"&gt;
      &lt;div class="large-8 columns"&gt;
        &lt;input type="text" name="realm" placeholder="Keywords/Skills" /&gt;
      &lt;/div&gt;
      &lt;div class="large-4 columns"&gt;
         {{ Form::select('category', $category_options , Input::old('category')) }}
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="row"&gt;
  
      &lt;div class="large-4 columns"&gt;
        {{ Form::select('location', $location_options , Input::old('location')) }}
      &lt;/div&gt;
  
  
      &lt;div class="large-4 columns"&gt;
        {{ Form::select('type', $position_options , Input::old('type')) }}
      &lt;/div&gt;
      &lt;div class="large-4 columns"&gt;
         &lt;input type="submit" value="Search" style="width:100%; padding-top: .5rem;
  padding-bottom: .5rem;" class="button border-btn" /&gt;
        &lt;/div&gt;
  
  
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Now according to the documentation there should not be an issue, and the page loads fine if the <code>-&gt;withInput();</code> is removed.</p>
  
  <p>The end goal is to roll in the answer that i received from my previous question <a href="https://stackoverflow.com/questions/22001054/undesired-result-from-dbraw">Undesired result from db:raw</a> and have a single page that loads the "Filtering" form and displays the relevant results on the reload and remembers the selections in the form.</p>
  
  <p>Thanks in advance.</p>
  
  <p>UPDATE:
  Following a comment i have updated the controller and routes, still same result:</p>
  
  <p>routes.php</p>
  
  <p><code>Route::get('jobs/search', 'JobsearchController@getSearch');</code></p>
  
  <p>&amp;</p>
  
  <p><code>Route::post('jobs/search', 'JobsearchController@getJobs');</code></p>
  
  <p>Controller</p>
  
  <pre><code> public function getSearch()
          {
                      $position_options = DB::table('jposition')-&gt;lists('friendly','id');
              $category_options = DB::table('jcategory')-&gt;lists('friendly','id');
              $location_options = DB::table('jlocation')-&gt;lists('friendly','id');
  
              return View::make('jobsearch.search', array('position_options' =&gt; $position_options, 'category_options' =&gt; $category_options, 'location_options' =&gt; $location_options));
          }
  
          public function getJobs()
  
          {
              $position_options = DB::table('jposition')-&gt;lists('friendly','id');
              $category_options = DB::table('jcategory')-&gt;lists('friendly','id');
              $location_options = DB::table('jlocation')-&gt;lists('friendly','id');
  
  
              return View::make('jobsearch.search', array('position_options' =&gt; $position_options, 'category_options' =&gt; $category_options, 'location_options' =&gt; $location_options))-&gt;withInput();
  
          }
  </code></pre>