So, i have table skips
id: int
student_id: int
status: bool
I am displaying the list of students in checkboxes and I want to save to the table if checked-1 and if not checked-0. Is it possible without JS and JQuery?
Part of controller
if ($request->has('submit')) {
$skip=new Skip;
$skip->student_id=$request->student;
$skip->status=
$skip->save();
}
Part of view:
<form method="POST" action="">
@csrf
@foreach($students as $student)
<p><input type="checkbox" name="student" value=""></p><br>
@endforeach
<button name='submit' type="submit" class="btn btn-primary">
Add
</button>
</form>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire