I'm trying to running my coding but I got error which is undefined variable.
Here's my controller:
$usr_color = DB::table('listbox')
->select('lstbx_codename','lstbx_descname')
->where('lstbx_cat', '=', 'usr_prf_color')
->orderBy('lstbx_no', 'asc')
->get();
Here's my view:
<div class="form-group">
<label>Color</label>
<select name="usr_prf_color" class="form-control">
@foreach ($usr_color as $color)
<option value="{{ $color-> lstbx_codename }}"
{{ old('usr_prf_color') == $color-> lstbx_codename ? 'selected' : '' }}>
{{ $color-> lstbx_descname }}
</option>
@endforeach
--}}
</select>
</div>
My error is "Undefined variable: usr_color".
$usr_colorto you view ? put that code$usr_colorin the controller's response?