Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #array #auto #fill #laravel
ADD COMMENT
Topic
Name
7+9 =