![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
Código PHP:
if (isset($_POST['postre']))
{
$postre = $_POST['postre'];
$n = count($postre);
$i = 0;
//echo "<li>{$postre[$i]}</li>";
while ($i < $n){
$sql = "DELETE FROM postres WHERE nom_postre = '" .$postre[$i] ."'" ;
$i++;
}
if ($result1 = mysql_query($sql)){
echo "Registros Eliminados" ;
} else {
echo "No";
}
return;
}
Código HTML:
<html> <body> <b>Selecciona tus postres favoritos:</b><br /><br /> <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>"> <? $result2 = mysql_query ("SELECT * FROM postres"); while ($rs = mysql_fetch_array ($result2)) { ?> <input name="postre[]" type="checkbox" value="<? echo $rs['nom_postre']; ?>"> <? echo $rs['nom_postre']; ?><br /> <? } ?> <input name="send" type="submit" id="send" value="Eliminar"> </form> </body> </html>