laravel option selected code example

Example: 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>

Tags:

Php Example