
Selleccionar filas checkeadas de tabla dinamicas
Publicado por Bladimir (3 intervenciones) el 09/12/2015 12:32:49
Hola a todos. Tengo una tabla html la cual lleno a partir de una base de datos. La ultima columna de ella es un checkbox el cual representa el id del registro. El asunto es que al pulsar un boton submit yo quiero eleiminar los registros en la base de datos que esten checkeados en la tabla dinamica. El codigo que uso para llenar la tabla es el siguiente:
.......
Cualquier ayuda se agradece. Saludos.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if (isset($_POST['ver']) && $_POST['ver']){
echo "<div id='scrolltable' style='overflow:auto; padding-right: 5px; padding-top: 5px; padding-left: 1px; padding-bottom: 15px; border-right: #6699CC 1px solid; border-top: #999999 1px solid; border-left: #6699CC 1px solid; border-bottom: #6699CC 1px solid; scrollbar-arrow-color : #999999; scrollbar-face-color : #666666; scrollbar-track-color :#3333333 ; position: center; height:185px; left: 100; top: 20; width: 100%;'>";
$comienzo = isset($_POST['inicio']) ? $_POST['inicio'] : null ;
$hasta = isset($_POST['fin']) ? $_POST['fin'] : null ;
$seleccionado = $_POST['busqueda'];
$link = mysqli_connect("localhost", "root", "", "Consulta") or die ('Error de conexion: ' . mysqli_error());
if ((strlen($comienzo)>1) && (strlen($hasta)>1)) {
if ($seleccionado=="Urologico"){
$result= mysqli_query($link,"SELECT CODIGO, NOMBRE, APELLIDO, CI, EDAD, FECHA, CONCEPTO, MONTO FROM RELACIONES WHERE (FECHA BETWEEN '".$comienzo."' AND '".$hasta."') AND CENTRO='UPO'");
echo " <table id='tabla1' border = 1 cellspacing = 1 cellpadding = 1 style= 'border: 2px solid #00008B border-collapse: collapse;' align='center'> <tr> <th>NOMBRE</th> <th>APELLIDO</th> <th>CI</th> <th>EDAD</th><th>FECHA</th><th>CONCEPTO</th><th>MONTO</th><th>ELEGIR</th></tr>";
while ($row = mysqli_fetch_array($result)){
echo " <tr> <td>".$row[1]."</td> <td>".$row[2]."</td> <td>".$row[3]."</td><td>".$row[4]."</td><td>".$row[5]."</td><td>".$row[6]."</td><td>".$row[7]."</td><td><input name='codigos' type='checkbox' value=".$row[0]." /></td></tr>";
}
$result1= mysqli_query($link,"SELECT MONTO FROM RELACIONES WHERE (FECHA BETWEEN '".$comienzo."' AND '".$hasta."') AND CENTRO='UPO' AND MONTO>'0'");
$suma=0;
while($sumar=mysqli_fetch_array($result1)){
$suma=$suma+$sumar["MONTO"];
}
echo " <tr> <td> </td> <td> </td> <td> </td><td> </td> <td> </td> <td>Total:</td><td>$suma</td><td> </td></tr>";
echo "</table>";
}
Cualquier ayuda se agradece. Saludos.
Valora esta pregunta


0