The essence of the problem is that I started to learn Laravel and I can not find information on how to pass many fields through the form, followed by validation. Form example:
How to do it right?
`<form class="mt-5" method="post" enctype="multipart/form-data"
@isset($word)
action=""
@else
action=""
@endisset
@csrf
@isset($word)
@method('PUT')
@endisset
<table class="table table-responsive-md">
<tbody>
<tr>
<th>ID</th>
<th>English</th>
<th>Transcription</th>
<th>Russian</th>
<th>Ukrainian</th>
<th>Module</th>
<th>Action</th>
</tr>
@for($i = 1; $i < 3; $i++)
<tr>
<td></td>
<td><input type="text" name="eng[]" class="form-control"
value=""></td>
<td><input type="text" name="transaction[]" class="form-control"
value=""></td>
<td><input type="text" name="ru[]" class="form-control"
value=""></td>
<td><input type="text" name="uk[]" class="form-control"
value=""></td>
<td><input type="text" name="category_id[]" class="form-control"
value=""></td>
<td></td>
</tr>
@endfor
</tbody>
</table>
<a class="btn btn-secondary mt-4" href="">Back</a>
<button class="btn btn-success mt-4">Save</button>
</form>`
The output is like this, but I know for sure that this is not right.
^ array:6 [▼ "_token" => "Olp8kMQIFoDP9OOvV5YRihcV3FpKIHofxfYk8W7M" "eng" => array:2 [▶] "transaction" => array:2 [▶] "ru" => array:2 [▼ 1 => "www" 2 => "qqq" ] "uk" => array:2 [▶] "category_id" => array:2 [▶] ]
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire