jeudi 8 septembre 2016

iCheck plugin not functioning with PHP

I am using the iCheck plugin for a form on my site, yet when I add this plugin, the PHP doesn't respond to any checkboxes being checked even though they are. I removed the plugin to test the form and the form works fine so I know the plugin is the problem?

http://ift.tt/1VqAPUw

if(isset($_POST['delete_selected'])){
    $select_mail = $_POST['select_mail'];
    foreach($select_mail as $mail_id){
        echo $mail_id.'<br>';
    }

}


<td><input type="checkbox" name="select_mail[]" value="<? echo $mail_id; ?>"></td>

JS:

<script src="plugins/iCheck/icheck.min.js"></script>
<script>
$(function () {
    //Enable iCheck plugin for checkboxes
    //iCheck for checkbox and radio inputs
    $('.mailbox-messages input[type="checkbox"]').iCheck({
      checkboxClass: 'icheckbox_flat-blue',
      radioClass: 'iradio_flat-blue'
    });

    //Enable check and uncheck all functionality
    $(".checkbox-toggle").click(function () {
      var clicks = $(this).data('clicks');
      if (clicks) {
        //Uncheck all checkboxes
        $(".mailbox-messages input[type='checkbox']").iCheck("uncheck");
        $(".fa", this).removeClass("fa-check-square-o").addClass('fa-square-o');
      } else {
        //Check all checkboxes
        $(".mailbox-messages input[type='checkbox']").iCheck("check");
        $(".fa", this).removeClass("fa-square-o").addClass('fa-check-square-o');
      }
      $(this).data("clicks", !clicks);
    });
  });
</script>

The checkboxes display nicely and they do show as marked when you click them, although when I actually submit the form - I am getting no responses from any checked boxes? Can anybody tell me why this might be happening or how I can resolve this issue? Thanks.




Aucun commentaire:

Enregistrer un commentaire