How to store select input data with Laravel?

Asked

Viewed 156 times

0

I cannot send the selected data to the request:

<select name="tipo_id" class="form-control col-md-3 col-xs-12">
    <option value=""></option>
    @foreach ($tipos as $tipo )
    <option name="tipo_id" value="{{$tipo->id}}">{{$tipo->description}}</option>
    @endforeach

Error:

SQLSTATE[HY000]: General error: 1364 Field 'tipo_id' doesn't have a default value (SQL: insert into `titulos` (`valor`, `updated_at`, `created_at`) values (200, 2019-02-26 17:01:06, 2019-02-26 17:01:06))
  • Try to take out the attribute name of your choice

1 answer

1


The SQL error is saying that you don’t have the field tipo_id in your Entity Titles. Check for the field tipo_id or if it is under a different name in the Entity

Browser other questions tagged

You are not signed in. Login or sign up in order to post.