php - How to make a form with multiple items from database with laravel -


i have taken list of items table in db , want make form consists of dropdown box containing these items. , when click item want added list next listbox can save these multiple items in db . (the main goal select single or multiple labels newsitem in site)

code in html gives list of labels (working) :

 @foreach($labels $label)              <p>{{$label}}</p>   @endforeach 

now need {{form:: ...... element creates dropdown box of these labels.

share|improve question
    
just surround foreach <select> ... , </select> , change <p> <option>{{$label}}</option> – alexander apr 25 '15 @ 9:55
up vote 1 down vote accepted

i solved jquery plugin :

http://harvesthq.github.io/chosen/

and code :

  <div class="form-group">         <select name="labels[]" class="form-control chosen-select-video" data-placeholder="add labels..." multiple >                @foreach ($labels $title)                    <option value="{{$title}}">{{ucfirst($title)}}</option>  <!-- capitalize first letter -->                @endforeach          </select>   </div> 
share|improve answer
    
cool man!!!!!!!!!!!!! – newman may 8 '15 @ 21:48

to create dropdown list in laravel can use-

echo form::select('size', array('l' => 'large', 's' => 'small')); 

here array list taken database. can find details laravel form helper in link. , showing list of selected item next dropdownlist should use javascript or jquery.

share|improve answer

your answer

 
discard

posting answer, agree privacy policy , terms of service.

not answer you're looking for? browse other questions tagged or ask own question.

Comments