I have a multi-step form in laravel where I pass the session variables from one view to the other and everything works ok.
This is part of my form
<div class="panel-body">
{!! Form::open(array('url' => '/post-quote')) !!}
<div class="form-group">
{!! Form::Label('brand', 'Brand:') !!}
<select class="form-control" name="brand" id="brand">
<option value="{{Input::old('brand')}}" selected="selected">{{Input::old('brand', 'Please select a Brand')}}</option>
@foreach($brands as $brand)
<option value="{{$brand->id}}">{{$brand->brand}}</option>
@endforeach
</select>
</div>
Here is part of my controller
public function quote()
{
$brands = Brand::orderBy('brand')->get();
return View::make('frontend.step1', compact('brands'));
}
The issue I got is that I am passing the id for each option value in the select and after validation, the Input::old populates the id value and it doesn't look right to display a number instead of the brand name.
Question: is there anyway to get input::old with the {{$brand->brand}} instead of the id?
My other option is to pass as a value for each option the brand name, however I dont know how to get the id for my input in the controller.
I hope you get what I am trying to achieve.
Thanks