Answer the question
In order to leave comments, you need to log in
How to write checkbox value to MySQL table?
There is a table dynamically generated from the database with checkboxes in one of the columns:
<table style="width: 1000;" id="activeTable" class="editableTable" overflow = "scroll">
<thead class="t_hdr">
<tr class="header">
<td><b>ID</b></td>
<td><b>Изготовитель</b></td>
<td><b>Адрес</b></td>
<td><b>Печать</b></td>
</tr>
</thead>
<tbody>
<input type="submit" class="my_button" name="update" value="UPDATE" style="width: 270px"/><br>
<? $i = 0;
while ($row = $Result->fetch_assoc()) {
$i++;
//$sql = $Database -> query("UPDATE izgotoviteli SET stamp = 0 WHERE id = $i");
?>
<tr id="z_<?=$i?>">
<td name = "post_id"><?=$row['id']?></td>
<td><?=$row['izgotovitel']?></td>
<td><?=$row['adress']?></td>
<td><label check></label><input type="checkbox" name="stamp[]" value="<?=$row['stamp']?>" <? if($row['stamp'] == 1)echo $check ?> onchange="save()" ></td>
</tr>
<? } ?>
</tbody>
</table>
<label check></label><input type="checkbox" name="stamp[]" value="<?=$row['stamp']?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question