forms - Select option :selected for edit in laravel 5 -
i building page edit record, having difficulty displaying select option saved/recorded entry :selected.
the select displays year option, 1990 2015.
this i've done far:
<select name="term_a" class="form-control"> <option value="0">choose year</option> @for ($i = 1990; $i < 2015; $i++) <option value="{{ $i }}">{{ $i }}</option> @endfor </select>
how can make stored data :selected?
edit:
i forgot mention did bind form model this:
{!! form::model($userdetails) !!}
and works ok, problem getting option select fetch old data :selected.
this should it:
<option value="{{ $i }}" {{ input::old('term_a') == $i ? 'selected' : '' }}>{{ $i }}</option>
Comments
Post a Comment