Answer the question
In order to leave comments, you need to log in
How to select multiple inputs in laravel to send values to the database?
There are several inputs received via foreach. How do I get the value of each and send each to the db referring to the id using Request?
@foreach ($services as $service)
<div class="row">
<div class="col-md-9">
{{ Form::text('services_item', $service->service_item, array('class' => 'form-control input-services', 'placeholder' => 'Введите название услуги')) }}
</div>
<div class="col-md-1">
<a href="/service_{{ $service->id }}/delete" class="btn btn-danger">Удалить</a>
</div>
</div>
@endforeach
Answer the question
In order to leave comments, you need to log in
Pass an array as the name attribute. For example:
@foreach ($services as $service)
<div class="row">
<div class="col-md-9">
{{ Form::text("services_item[]", $service->service_item, array('class' => 'form-control input-services', 'placeholder' => 'Введите название услуги')) }}
</div>
<div class="col-md-1">
<a href="/service_{{ $service->id }}/delete" class="btn btn-danger">Удалить</a>
</div>
</div>
@endforeach
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question