Level 10
Ok I think I got it....
{!! $town->id !!} in value and {!! $town->name !!} in the option itself.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I am struggling with this one, I would like to have 2 types of dropdown menu templates for my IDE so I can just copy/paste them when needed.
I cannot work out how to use blade and the dropdowns when the data is pulled from the database Select a Town @if ($towns)
@foreach($towns as $town)
{{ how to render the options here? }}
@endforeach
@endif
</select>
@if ($errors->has('towns'))
@endif <span class="help-block">
<strong>{{ $errors->first('towns') }}</strong>
</span>
@endif
</div>
</div>
Also how to keep the value of the drop down if there is an error (on page refresh) please.
Thank you.
Please or to participate in this conversation.