Laravel driver syntax error

1

I get the null fields, because it is not an "input" what I am receiving, but an "option" but I do not know how to declare it so that it grabs the value of the option for my record.

Form:

<form class="form-horizontal" action="{{url('/orderSet')}}" method="POST">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
  <div class="form-group">
      <label class="control-label col-sm-2" for="pwd">Empleado:</label>
      <div class="col-sm-10">
         <select class="form-control">
         @foreach($emp as $e)
             //Dato enviado: <option name="Employee" value="{{$e->id}}">{{$e->Name}}</option>
@endforeach
        </select>
        </div>
    </div>

Controller:

public function orderSet(Request $data){
    $order= new Order();
    $order->idAdmin="1";
    $order->idEmployee=$data->input('Employee');//datoRecibido(en blanco porque no es un input)
    $order->idClient=$data->input('Client');
    $order->idServices=$data->input('Service');
    $order->Description=$data->input('Password');
    $order->Status='1';
    $order->save();
    return Redirect('/order');
}
    
asked by R. Quiñonez 24.05.2017 в 04:19
source

1 answer

0

The name property should go to the <select> tag and not <option> :

<select class="form-control" name="Employee">
  @foreach($emp as $e)
    <option value="{{$e->id}}">{{$e->Name}}</option>
  @endforeach
</select>
    
answered by 24.05.2017 / 06:05
source