in php I take an id and a name from my database in mysql and show each name in a checkbox.
The problem is that I need to mark several and give a button to delete them and for that I show in javascript a message confirm for security. To the message confirm I pass the names but I also need to pass the id since when I go back to php I need the id to carry out another query and delete the ones I have marked.
In the php:
echo "<form name=form method=POST action=principal.php?orden=desasignar>";
//Recorro la matriz para sacar el valor de todos que es el nombre
for($i=1;$i<=count($resultsetAsignado);$i++){
echo "<td><input type=checkbox name='clientes' value='".$resultsetAsignado[$i][1]."' id='idDelCliente'>".$resultsetAsignado[$i][1]."</td>";
//mandamos los id_de los clientes
echo "<input type=hidden name='id' value=".$resultsetAsignado[$i][0]." >";
echo "</tr>";
}
echo "</table>";
//boton
echo "<input type=button name=boton value='Desasignar' onClick='confirmacion();'>";
echo "</form>";
In javascript
function confirmacion(){
//Realizo el confirm y cojo los nombres y los muestro en el confirm
//y despues lo mando con submit
document.form.submit();
}
In the 0 I keep the id and in the 1 the name.
Any ideas? If you do not understand something tell me