Answers for "laravel select default old value"

PHP
0

laravel old value for select option

@foreach($services as $service)
	@if (old('category') == $service->id)
  		<option value="{{ $service->id }}" selected>{{ $service->title }}</option>
  	@else
		<option value="{{ $service->id }}">{{ $service->title }}</option>
	@endif
@endforeach
Posted by: Guest on May-29-2020
0

option value selected in laravel blade

{{ old('title') == '1' ? 'selected' : '' }}
<div class="form-group col-md-6">
<label>Nationality {{$profiledata->nationality}}</label>
   <select id="nationality" required="" name="nationality" class="form-control">
    <option value="">--Select--</option>
    <option {{ ($profiledata->nationality) == 'United State' ? 'selected' : '' }}  value="United State">United State</option>
    <option {{ ($profiledata->nationality) == 'India' ? 'selected' : '' }}  value="India">India</option>
    <option {{ ($profiledata->nationality) == 'Canada' ? 'selected' : '' }}  value="Canada">Canada</option>
  </select>
</div>
Posted by: Guest on November-20-2020
0

laravel select default old value

<option value="{{ $key }}" {{ (Input::old("title") == $key ? "selected":"") }}>{{ $val }}</option>
Posted by: Guest on March-01-2021

Browse Popular Code Answers by Language