checkbox marcado valor = 1
checkbox desmarcado valor = 0
Como le puedo enviar el valor de cada checkbox a la consulta con solo hacer onclick ?
index.html
Código HTML:
Ver original
<form action="checkbox.php" method="post"> <input type="checkbox" name="check 1">opcion 1 <input type="checkbox" name="check 2">opcion 2 <input type="checkbox" name="check 3">opcion 3 <input type="checkbox" name="check 4">opcion 4 <input type="checkbox" name="check 5">opcion 5 <input type="checkbox" name="check 6">opcion 6 <input type="checkbox" name="check 7">opcion 7 <input type="checkbox" name="check 8">opcion 8 <input type="checkbox" name="check 9">opcion 9 <input type="checkbox" name="check 10">opcion 10 <input type="checkbox" name="check 11">opcion 11 <input type="checkbox" name="check 12">opcion 12 <input type="checkbox" name="check 13">opcion 13 <input type="checkbox" name="check 14">opcion 14 <input type="checkbox" name="check 15">opcion 15 <input type="checkbox" name="check 16">opcion 16 <input type="checkbox" name="check 17">opcion 17 <input type="checkbox" name="check 18">opcion 18 <input type="checkbox" name="check 19">opcion 19 <input type="checkbox" name="check 20">opcion 20 <input type="checkbox" name="check 21">opcion 21 <input type="checkbox" name="check 22">opcion 22 <input type="checkbox" name="check 23">opcion 23 <input type="checkbox" name="check 24">opcion 24 <input type="checkbox" name="check 25">opcion 25 <input type="checkbox" name="check 26">opcion 26 <input type="checkbox" name="check 27">opcion 27 <input type="checkbox" name="check 28">opcion 28 <input type="checkbox" name="check 29">opcion 29 <input type="checkbox" name="check 30">opcion 30 </form>
checkbox.php
Código PHP:
Ver original
$q = "UPDATE mitabla set estado= $check_estado".