最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Unable to Update a dropdown value - Stack Overflow

programmeradmin5浏览0评论

I need to select a dropdown value on an application and should be in a position to go back and update it.

I am using HTML and CSS in front end. and PHP as the backend language.

I am able to select a dropdown value and submit/update. I am using the code below:

@php
$followups= \App\Models\Followup::latest()->get();
@endphp

<div class="col-md-4 col-6">
    <div class="form-group mb-30">
        <label class="input-label mb-2">{{translate('Followup')}}*</label>
        <select class="sselect-identity theme-input-style mb-30" name="followup">
            <option value="">-- Select an option --</option>
            @foreach($followups as $followup)
                <option value="{{$followup->followup}}">
                    {{$followup->followup}}
                </option>
            @endforeach
        </select>
    </div>
</div>

However, when I go back to select a value in a dropdown. It is stuck and unable to select any other value. I am using the code below for a second edit/update of the dropdown:

@php
$followups= \App\Models\Followup::latest()->get();
@endphp

<div class="col-md-4 col-6">
    <div class="form-group mb-30">
        <label class="input-label mb-2">{{translate('Follow up')}}*</label>
        <select class="select-identity theme-input-style mb-30" name="followup" required>
            <option value="">{{ translate('Select an Option') }}</option>
            @foreach ($followups as $followup)
                <option value="{{ $followup->followup }}"
                    {{ $followup->followup === $userDeatials->followup ? 'selected' : '' }}>
                    {{ $followup->followup }}
                </option>
            @endforeach
        </select>
    </div>
</div>

I have tried using the html code to fetch the values from a database table. The same code is repeated in the update html code. It does recognize what value is selected in the first update. But I am unable to click on the dropdown and select any other value.

发布评论

评论列表(0)

  1. 暂无评论