Support the ongoing development of Laravel.io →
posted 10 years ago
Views Blade
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

teeyo teeyo Joined 14 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.