Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/11/2010, 13:10
Death_Empire
 
Fecha de Ingreso: febrero-2010
Mensajes: 818
Antigüedad: 14 años, 2 meses
Puntos: 55
Respuesta: Por cada onclic en un checkbox enviar dato a BD

te dejo un ejemplo de como hacerlo con jquery
Código HTML:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>
$(function(){
	$("#id_checkbox").click(function(){
		if($("#id_checkbox").is(":checked") == 1){		
			$.post("script.php",{nombre_variable:$("#id_checkbox").val()},function(data){alert(data);});	
		}
	});
});
</script>
</head>
<body>
Actualiza BD: <input type="checkbox" name="n" id="id_checkbox" value="VALOR">
</body>
</html> 
script.php
Código PHP:
<?php
if(isset($_POST['nombre_variable']) AND $_POST['nombre_variable'] != ''){
    echo 
"Recibo el Valor y Hago lo que Quiero en PHP";
}
?>