Get the database value in an html select?

3

How can this be done that is shown in the value but with a select that brings the values of the database

Like the following example:

<input type="text" name="measure" class="form-control{{ 
$errors->has('measure') ? ' is-invalid' : '' }}" 
value="{{$food->measure}}" 
placeholder="Ingrese la porción" required>
    
asked by Gustavo 21.08.2018 в 22:25
source

1 answer

2

Try this way:

This is more than this must go within a cycle that runs through all the rows that brings the query

<select name="measure" class="form-control{{ $errors->has('measure') ? ' is-invalid' : '' }}">
  //valor por defecto que es omitido al capturar
  <option value="">Selecciona la Porcion</option>
  <option value="{{$food->measure}}">{{$food->measure}}</option>
</select>
    
answered by 21.08.2018 в 22:32