1

How to get all the Checked Checkboxes values From View to Controller???

My view page code is,

{!! Form::checkbox('control_type[]', 001, '', array('id'=>'control_type', 'name'=>'control_type[]')) !!} {!! trans('noorsi.control_type_001') !!}</br>
{!! Form::checkbox('control_type[]', 002, '', array('id'=>'control_type', 'name'=>'control_type[]')) !!} {!! trans('noorsi.control_type_002') !!}</br>
{!! Form::checkbox('control_type[]', 003, '', array('id'=>'control_type', 'name'=>'control_type[]')) !!} {!! trans('noorsi.control_type_003') !!}

and my controller page code is,

$control_type = $request->get('control_type');

I just want to get the values(001,002...) of checked checkboxes... Can anyone help me...?

1 Answer 1

4

In your controller you can get the values like $request->input('control_type'). This will be an array. Now you can loop through the array to get the individual values.

like:

foreach($request->input('control_type') as $value){
  // $value
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.