Skip to content Skip to sidebar Skip to footer

Checkbox With Array Inside Looping False Result?

I have checkbox inside looping like this.

Solution 1:

Include the row number in the names of all the checkboxes. Only the checked boxes get submitted, and PHP will index them all from 0 if they don't have an explicit index -- you won't see empty values for the checkboxes that are skipped.

for($i=0;$i<$jumlah;$i++)  {

     echo "<tr>
          <td align='center'><input type='text' name='PROSES[]' placeholder='Input Proses $i'/></td>
          <td align='center'><input type='checkbox' name='NOTIF[$i]'  value='Yes'/></td>
          <td align='center'> <input type='checkbox' name='REMINDER[$i]'  value='Yes'/></td>
          <td align='center'> <input type='checkbox' name='DECISION[$i]'  value='Yes'/></td>
          <td align='center'> <input type='checkbox' name='AUTHOR[$i]'  value='Yes'/></td>
          <td align='center'><input type='text' name='SIAPA[]' size='40' placeholder='dari siap ke siapa' /></td>
      </tr>";


}//end for

Post a Comment for "Checkbox With Array Inside Looping False Result?"