Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel display multiple selected values

$selected = explode(",", $products->supplier_id);

<select  name="supplier_id[]" multiple="multiple">
   @foreach($suppliers as $supplier)
     <option value="{{ $supplier->id }}" {{ (in_array($supplier->id, $selected)) ? 'selected' : '' }}>{{ $supplier->name}}</option>
   @endforeach
</select>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #display #multiple #selected #values
ADD COMMENT
Topic
Name
9+1 =