Search
 
SCRIPT & CODE EXAMPLE
 

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>
Comment

PREVIOUS NEXT
Code Example
Php :: Attempt to read property "name" on bool 
Php :: logout php code 
Php :: laravel create custom artisan command 
Php :: Syntax error or access violation: 1055 
Php :: php wordpress 
Php :: carbon check sunday 
Php :: setup PDO 
Php :: 3. Write a php script function to get the data type and the value of the variable $x = true. 
Java :: Cannot fit requested classes in a single dex file 
Java :: import android.support.v7.app.appcompatactivity error 
Java :: java enum get nex 
Java :: getcolor deprecated 
Java :: rgb to hex java 
Java :: bukkit delayed task 
Java :: java integer to binary string with leading zeros 
Java :: default structure of java 
Java :: java check if able to parse int 
Java :: center justify jlabel 
Java :: java remove non numeric characters from string 
Java :: exit app android 
Java :: array to map java4 
Java :: java close jframe 
Java :: java create txt file 
Java :: how to convert object to list in java 
Java :: how to take space separated input in java 
Java :: spring context xml definition 
Java :: java robot left click 
Java :: StringBuilder java pop back 
Java :: stackoverflow spring regex 
Java :: Integer i = new Integer(257); byte x = i.byteValue(); System.out.print(x); 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =