I have had a lengthy search both here and the Laravel forums, but i can\'t find an answer to this problem. ->withInput()
coughs up an Undefined offset: 0>
withInput()
doesn't work the way you think it does. It's only a function of Redirect, not View.
Calling withInput($data)
on View has a completely different effect; it passes the following key value pair to your view: 'input' => $data
(you get an error because you're not passing any data to the function)
To get the effect that you want, call Input::flash()
before making your view, instead of calling withInput()
. This should allow you to use the Input::old()
function in your view to access the data.
Alternatively, you could simply pass Input::all()
to your view, and use the input[]
array in your view:
View::make(...)->withInput(Input::all());
which is translated to
View::make(...)->with('input', Input::all());
As for your comment, I recommend doing it like so:
$position_options = DB::table('jposition')->lists('friendly','id');
$category_options = DB::table('jcategory')->lists('friendly','id');
$location_options = DB::table('jlocation')->lists('friendly','id');
$category = Input::get('category');
$location = Input::get('location');
$type = Input:: get('type');
$data = compact('position_options', 'category_options', 'location_options', 'category', 'type', 'location');
return View::make('jobsearch.search', $data);