Search
 
SCRIPT & CODE EXAMPLE
 

PHP

array value auto fill in old value laravel 8

<label for="name">Tags</label>
    <select name="tags[]" class="form-control select-tag" multiple>
      @foreach($tags as $tag)
        <option value="{{$tag->id}}" {{in_array($tag->id, old("tags") ?: []) ? "selected": ""}}>{{$tag->name}}</option>
      @endforeach
    </select>
Comment

array value auto fill in old value laravel 8

<select id="recommended_food"   multiple="multiple" size=3 style='height: 100%;' name="recommended_food[]">
    @if ($food->recomemded_food)
      {{ ($val = 'Fries')
        && $chosen = in_array($val, $food->recommended_food)
        ? 'selected':null}}
      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
      {{ ($val = 'Hot Dogs')
        && $chosen = in_array($val, $food->recommended_food)
        ? 'selected':null}}
      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
      {{ ($val = 'Hamburgers')
        && $chosen = in_array($val, $food->recommended_food)
        ? 'selected':null}}
      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
    @endif
  </select>
Comment

array value auto fill in old value laravel 8

<select id="forWhom" name="forWhom[]" multiple class="form-control chosen">
    <option value="">--- Select ---</option>
    @foreach ($desgInfo as $key => $value)
        <option value="{{ $key }}" 
           {{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }}  />
           {{ $value }}
        </option>
    @endforeach
</select>
Comment

array value auto fill in old value laravel 8

{{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }} 

{{ (in_array($key,$info->forWhom)) ? 'selected' : ''}}
Comment

array value auto fill in old value laravel 8

<select id="forWhom" name="forWhom[]" multiple class="form-control chosen">
        <option value="">--- Select ---</option>
        @foreach ($desgInfo as $key => $value)
            <option value="{{ $key }}" 
               {{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }} 
               {{ (in_array($key,$info->forWhom)) ? 'selected' : ''}}  
               />
               {{ $value }}
            </option>
        @endforeach
    </select>
Comment

array value auto fill in old value laravel 8

<select name="options[]" id="options" class="form-control" multiple>
    @foreach($settings->includes->get('optionList') as $option)
        <option value="{{ $option->id }}" {{ (collect(old('options'))->contains($option->id)) ? 'selected':'' }}>{{ $option->name }}</option>
    @endforeach
</select>
Comment

array value auto fill in old value laravel 8

<label for="name">Tags</label>
    <select name="tags[]" class="form-control select-tag" multiple>
      @foreach($tags as $tag)
        <option value="{{$tag->id}}" {{in_array($tag->id, old("tags") ?: []) ? "selected": ""}}>{{$tag->name}}</option>
      @endforeach
    </select>
Comment

array value auto fill in old value laravel 8

<select id="recommended_food"   multiple="multiple" size=3 style='height: 100%;' name="recommended_food[]">
    @if ($food->recomemded_food)
      {{ ($val = 'Fries')
        && $chosen = in_array($val, $food->recommended_food)
        ? 'selected':null}}
      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
      {{ ($val = 'Hot Dogs')
        && $chosen = in_array($val, $food->recommended_food)
        ? 'selected':null}}
      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
      {{ ($val = 'Hamburgers')
        && $chosen = in_array($val, $food->recommended_food)
        ? 'selected':null}}
      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
    @endif
  </select>
Comment

array value auto fill in old value laravel 8

<select id="forWhom" name="forWhom[]" multiple class="form-control chosen">
    <option value="">--- Select ---</option>
    @foreach ($desgInfo as $key => $value)
        <option value="{{ $key }}" 
           {{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }}  />
           {{ $value }}
        </option>
    @endforeach
</select>
Comment

array value auto fill in old value laravel 8

{{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }} 

{{ (in_array($key,$info->forWhom)) ? 'selected' : ''}}
Comment

array value auto fill in old value laravel 8

<select id="forWhom" name="forWhom[]" multiple class="form-control chosen">
        <option value="">--- Select ---</option>
        @foreach ($desgInfo as $key => $value)
            <option value="{{ $key }}" 
               {{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }} 
               {{ (in_array($key,$info->forWhom)) ? 'selected' : ''}}  
               />
               {{ $value }}
            </option>
        @endforeach
    </select>
Comment

array value auto fill in old value laravel 8

<select name="options[]" id="options" class="form-control" multiple>
    @foreach($settings->includes->get('optionList') as $option)
        <option value="{{ $option->id }}" {{ (collect(old('options'))->contains($option->id)) ? 'selected':'' }}>{{ $option->name }}</option>
    @endforeach
</select>
Comment

PREVIOUS NEXT
Code Example
Php :: Laravel Cache store [none] is not defined. 
Php :: database interaction in codeigniter 
Php :: php find longest string in array 
Php :: Get authors who has posts in category - WordPress 
Php :: Comment ajouter un fil d’Ariane personnalisé à l’URL d’accueil dans WooCommerce 
Php :: df/mpdf/src/Cache.php on line 21 
Php :: build_Assoc 
Php :: code to set error for du[licate entry in php 
Php :: php code for adding dara 
Php :: Drupal 9 select node data with query conditions using entity type manager 
Php :: fixing http error laravel on ubuntu 
Php :: check which php.ini file enabled from code 
Php :: laravel check if pagination is empty 
Php :: user1263019 how to upload a file using php curl 
Php :: php sort multidimensional array by child value 
Php :: Add Spatie provider to providers 
Php :: rollback a specific migration laravel 
Php :: white labeling wordpress divi 
Php :: PHP DOMDocument, Unicode problems 
Php :: php bcdiv 
Php :: laravel retain old value 
Php :: Laravel : Pass dynamic variables to routes 
Php :: laravel gigapay resend invite to employee 
Php :: PHP OOP - Static Methods 
Php :: strtotime last day of month 
Php :: generate random color php 
Php :: laravel General error: 1215 Cannot add foreign key constraint" 
Php :: country 
Php :: laravel make migration 
Php :: run php with xampp 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =