jeudi 3 septembre 2015

Laravel save dropdown value

I've made a dropdown in laravel but when I save the request it won't save the value that was selected. How do can I achieve this?

This is my code in my view:

  <div class="form-group">
        <label for="content" class="col-lg-2 control-label">Karakterrit</label>
            <div class="col-lg-10">
               <select class="form-control input-sm" name="">
                  @foreach($karakterrit as $krit)
                     <option value="{!! $krit->id !!}">{!! $krit->rit !!}</option>
                  @endforeach
                </select>               
              </div>
   </div>

And this is my controller where I save the request:

 public function store(Request $request)
    {
        $rit = new Rittenregistratie($request->all());
        Auth::user()->Rittenregistratie()->save($rit);
        return redirect('/create')->with('message','Rit '.$rit->id.' is aangemaakt.');
    }

It saves everything right except the value from the dropdown which must be a number.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1VyJByk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire