jeudi 25 mai 2017

Auto submitting Checkbox to save to MySQL

I have a page on my website with a 20 checkboxes for each user that has an account, i want to be able to submit the checkbox when it is changed to save it to a DB. Its hard to explain, but i will attach screenshots of the code, HTML output and DB:

PHP code to get the boxes is:

<?php
for ($x = 1; $x <= 16; $x++) { $result0 = $db->query("SELECT * FROM View WHERE
UserIDLIKE '" . $x . "'"); while($row0 = mysqli_fetch_array($result0)) { if($row0['20']=="1"){$checked = "checked";}else { $checked = "";}} echo "<td class=\"align_center\"><input type=\"checkbox\" name=\"20_" . $x . "\" " . $checked . "/> ";} ?>

checkboxes

html output

DB

Im hoping someone can help! PLEASE!

Thanks




Aucun commentaire:

Enregistrer un commentaire