I'm trying to pass checkbox
values to a array
, but unchecked fields do not populate array
. I need to fill in the fields not checked with the value "N" for example:
Example in a loop of 5 results:
<?php
while(5x) : ?>
<td><input name="ocultarsub[]" type="checkbox" value="S" <?php if($ocultar_sub =='S'){echo "checked"; } ?> ></td>
<?php
endwhile;
?>
I get output:
array(2) { [0]=> string(1) "S" [1]=> string(1) "S" }
I need to popular those not checked with the letter N for example:
array(5) { [0]=> string(1) "S" [1]=> string(1) "S" [2]=> string(1) "N" [3]=> string(1) "N" [4]=> string(1) "N"}