samedi 11 février 2017

Inputs checkbox save only checked state

I have the following input checkbox in my html

<form id="frmHorarios" role="form" method="POST" action="">
    
    @foreach($dias as $dia)
        <input type="checkbox" name="cerrado[]"  class="icheck" value=""></label>
    @endforeach
</form>

The loop iterate 5 times. What I need is to get the state for each checkbox.

If I only enable two checkbox the controller receive an array of ["true", "true"] (if I checked the last two checkbox)

But I need to know what checkbox was enabled so the result have to be: ["false", "false", "false","true", "true"]

Whats happen with the code that is not working?

Thanks!



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

Aucun commentaire:

Enregistrer un commentaire