Number the input array.
{{ Form::checkbox('options[0]', 'value1'); }}
{{ Form::checkbox('options[1]', 'value2'); }}
{{ Form::checkbox('options[2]', 'value3'); }}
Input::get('options') will then return an array.
I came back to post the solution but you were faster than me, anyway thanks iWader, we can either put numbers or strings in order to get an associative array. Thanks again.
If you are binding a model, and the model has an options
attribute that provides an array of currently active values (e.g. ['value1', 'value3']
, then what was posted right at the start works perfectly.
You don't care what the element keys are, because everything operates around the array values.
(L5.1)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community