Answers for "laravel display multiple selected values"

PHP
0

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>
Posted by: Guest on May-01-2021

Code answers related to "laravel display multiple selected values"

Browse Popular Code Answers by Language