Issue
I'm trying to show the user what type of gender they currently have selected. (It's in dutch, Geslacht = Gender)
Here's the code:
<div class="row">
<div class="col-sm">
<div class="form-group text-muted">
<label for="name">Geslacht:</label>
<select class="custom-select">
<option selected value="{{Auth::user()->geslacht}}">Kies een optie</option>
<option value="1">Mannelijk</option>
<option value="2">Vrouwelijk</option>
<option value="3">Zeg ik liever niet</option>
</select>
</div>
</div>
If you know how I might fix this please let me know ;)
Solution
<option value="1" @if(Auth::user()->geslacht == 1) selected @endif>Mannelijk</option>
<option value="2" @if(Auth::user()->geslacht == 2) selected @endif>Vrouwelijk</option>
<option value="3" @if(Auth::user()->geslacht == 3) selected @endif>Zeg ik liever niet</option>
You can check in the option like this and if matched value then you can select it
Answered By - atikur rahman Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.