Checkbox PHP con MySQL
 
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 
 
-   
checkbox.php   
Código PHP:
Ver original- $q = "UPDATE mitabla set estado= $check_estado". 
Esto es lo que tengo.    
Código PHP:
Ver original- <?php 
-   
- echo" 
- <script language='javascript' type='text/javascript'> 
- <!-- 
- // Get the HTTP Object 
- function getHTTPObject(){ 
-     if (window.ActiveXObject) return new ActiveXObject('Microsoft.XMLHTTP'); 
-         else if (window.XMLHttpRequest) return new XMLHttpRequest(); 
-     else { 
-         alert('Your browser does not support AJAX.'); 
-         return null; 
-     } 
- } 
-   
- // Change the value of the outputText field 
- function setOutput(){ 
-     if(httpObject.readyState == 4){ 
-         document.getElementById('outputText').value = httpObject.responseText; 
-     } 
- } 
-   
- // Implement business logic 
- function doWork(){ 
-     httpObject = getHTTPObject(); 
-     if (httpObject != null) { 
-         httpObject.open('GET', 'checkbox.php?inputText=' 
-         +document.getElementById('inputText').checked == true, true); 
-         httpObject.send(null); 
-         httpObject.onreadystatechange = setOutput; 
-     } 
- } 
- var httpObject = null; 
- //--> 
- </script> 
- "; 
-   
- echo" 
- <form name='testForm'> 
- <input type='checkbox' name='check 1' value='0' onclick='doWork();'  id='inputText'>opcion 1 
-   
-   
- Output text: <input type='text' name='outputText' id='outputText' /> 
- </form> 
- "; 
-   
- ?> 
checkbox.php   
Código PHP:
Ver original- <?php 
-   
- $valor = $_GET['inputText']; 
- echo "$valor"; 
-   
- ?>