dimanche 22 mai 2016

How to get unchecked checkbaox values in Laravel (PHP)

There are 4 check boxes with the same name in the view, and when I get the values in the laravel(php) controller with that name, I am supposed to get an array. But I am only getting the values of the check boxes which are checked, even I am not getting zero or null in place of unchecked checkboxes.

<div id="action1" name="action1[]">
                            <input type="checkbox" name="checkAction1[]" >
                            <select id="a1" class="form-control actionSelect" name="action1[]" >
                                <option value="" selected="selected">Action Name</option>
                            </select>
                            <select class="form-control catSelect" name="cat1[]">
                                <option value="" selected="selected">Category Type</option>
                            </select>

                        </div>
                        <div id="action2" name="action1[]">
                            <input type="checkbox"  name="checkAction1[]" >
                            <select class="form-control actionSelect" name="action1[]" >
                                <option value="" selected="selected">Action Name</option>
                            </select>
                            <select class="form-control catSelect" name="cat1[]">
                                <option value="" selected="selected">Category Type</option>
                            </select>

                        </div>
                        <div id="action3" name="action1[]">
                            <input type="checkbox"  name="checkAction1[]" >
                            <select class="form-control actionSelect" name="action1[]" >
                                <option value="" selected="selected">Action Name</option>
                            </select>
                            <select class="form-control catSelect" name="cat1[]">
                                <option value="" selected="selected">Category Type</option>
                            </select>

                        </div>
                        <div id="action4" name="action1[]">
                            <input type="checkbox"  name="checkAction1[]" >
                            <select class="form-control actionSelect" name="action1[]" >
                                <option value="" selected="selected">Action Name</option>
                            </select>
                            <select class="form-control catSelect" name="cat1[]">
                                <option value="" selected="selected">Category Type</option>
                            </select>

                        </div>

Controller:

$checkboxArray=$request['checkAction1'];

Its only giving checked check boxes.

Could any one help on this. Thank you.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TvvMjR
via IFTTT

Aucun commentaire:

Enregistrer un commentaire