Level 37
double check the html printed out. especially the 'excercises[]'
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to save multiple checkbox values from my form to the $request array but it is only saving one checkbox value.
Here is my code:
Here is the form:
@foreach($exercise_type->exercises as $exercise)
{!! Form::label('exercise_name', $exercise->exercise_name) !!}
{!! Form::checkbox( 'exercise[]', "{$exercise->id}-{$exercise->exercise_type_id}-{$exercise->exercise_name}") !!}
</br>
@endforeach
Here is the code for retrieving the Request array values:
public function store(Request $request)
{
$values = $request->input('exercise');
return $values;
}
Please or to participate in this conversation.