Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JokersMild85's avatar

Save multiple checkbox values to $request array and retrieve them

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;
}
0 likes
1 reply
robrogers3's avatar

double check the html printed out. especially the 'excercises[]'

Please or to participate in this conversation.