I have a form that is used to read multiple rows of data from one table, display it and then allow the user to complete a form and then save the data into another table. I believe this is handled in the form of an array. This has been working well, but I would like to add some checkboxes to simplify data input. I have added the checkboxes to the form but I cannot seem to get the values from these checkboxes into the database. It is these arrays that I am struggling with, I think I need to specify the $row that the checked checkboxes belong to.
I hope this makes sense, I am still new to this.
Here is my form..
echo "<tr>";
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>Check1<input type='checkbox' id='check1[]' name='check1[]' value='Y' /></td>";
echo "<td>Check2<input type='checkbox' id='check2[]' name='check2[]' value='Y' /></td>";
echo "<td>Check3<input type='checkbox' id='check3[]' name='check3[]' value='Y' /></td>";
echo "<td>Check4<input type='checkbox' id='check4[]' name='check4[]' value='Y' /></td>";
echo "<td>Check5<input type='checkbox' id='check5[]' name='check5[]' value='Y' /></td>";
echo "<td>Check6<input type='checkbox' id='check6[]' name='check6[]' value='Y' /></td>";
echo "<td>Check7<input type='checkbox' id='check7[]' name='check7[]' value='Y' /></td>";
echo "<td>Check8<input type='checkbox' id='check8[]' name='check8[]' value='Y' /></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>";
Aucun commentaire:
Enregistrer un commentaire