I have a form that I have added some checkboxes to, but the checkboxes keep iterating.
The section of my form is:
echo '<td><a href="photos16\\'.$row['SURNAME'].", ".$row['FIRST_NAME'].'.jpg" target="_blank"><img src="photos16\\'.$row['SURNAME'].", ".$row['FIRST_NAME'].'.jpg" height="60"></td></a>';
echo '<td class="combname"><input style="border:none" readonly type="text" name="comb_name[]" value="  '.$row['FIRST_NAME']." ".$row['SURNAME'].'" /></td>';
echo "<td><input style='border:none' readonly type='hidden' name='first_name[]' value='".$row['FIRST_NAME']."' /></td>";
echo "<td><input style='border:none' readonly type='hidden' name='surname[]' value='".$row['SURNAME']."' /></td>";
echo "<td><input style='border:none' readonly type='text' name='stkey[]' value='".$row['STKEY']."' /></td>";
echo "<td><input type='hidden' name='check1[]' value='' /></td>";
echo "<td>Check1<input type='checkbox' name='check1[]' value='1'/></td>";
echo "<td><input type='hidden' name='check2[]' value='' /></td>";
echo "<td>Check2<input type='checkbox' name='check2[]' value='2' /></td>";
echo "<td><input type='hidden' name='check3[]' value='' /></td>";
echo "<td>Check3<input type='checkbox' name='check3[]' value='3' /></td>";
echo "<td>Other: <input type='text' size='15' id='violation' name='violation[]' value='' /></td>";
echo "<td><input type='hidden' name='gender[]' value='".$row['GENDER']."' /></td>";
echo "<td><input type='hidden' name='year[]' value='".$row['SCHOOL_YEAR']."' /></td>";
echo "<td><input type='hidden' name='rollgroup[]' value='".$row['ROLL_GROUP']."' /></td>";
echo "<td><input type='hidden' name='house[]' value='".$row['HOUSE']."' /></td>";
echo "<td><input type='hidden' name='user[]' value=$user /></td>";
echo "</tr>";
The output of the array around the checkboxes:
[check1] => Array ( [0] => [1] => 1 [2] => [3] => [4] => 1 [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => ) [check2] => Array ( [0] => [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => ) [check3] => Array ( [0] => [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => )
Which is mostly correct, but check1 should be [1]=>1 and [3]=>1 but instead it is 1 and 4 and I cannot work out why.
Aucun commentaire:
Enregistrer un commentaire