为什么不在此功能上按提交按钮时提示null和1以及null和1?

Why not alert 0 and 1 and 0 and 1 when press submit button on this function ?

When press submit, it's will alert 1,1, null , null.

Why not alert null,1,null,1 ?

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<?PHP
include("connect.php");
?>


<?php
    if(isset($_POST["submit"]))
    {
       for($i=0;$i<count($_POST["a_text"]);$i++)
       {
      $a_check = mysql_real_escape_string($_POST['a_check'][$i]);
?>
<script>
alert("<?PHP echo $a_check; ?>");//
</script>

<?PHP
       }
    }
?>


<form name="f_name" method="post" action="">
    <input name="a_text[]" type="text">
    <input name="a_check[]" type="checkbox" value="1">
    <br>
    <input name="a_text[]" type="text">
    <input name="a_check[]" type="checkbox" value="1" checked >
    <br>
    <input name="a_text[]" type="text">
    <input name="a_check[]" type="checkbox" value="1">
    <br>
    <input name="a_text[]" type="text">
    <input name="a_check[]" type="checkbox" value="1" checked >
    <br>
    <input type="submit" name="submit" value="OK"/>
</form>

When you post array of checkbox then it only post Selected checkbox. So, In your case first and third not selected and second and fourth is selected that's why it return null,1,null,1

If you are select second and fourth checkbox then it will post checkbox like as follow

a_check = [null,1,null,1];

You want to access all four checkBox through loop actually which is not posted If you are not checked.