Niente ora però l'errore non me lo da ma quando provo a cnacellare tipo 3 utenti premo cancella e mi esce solo una pagina bianca e basta ecco i codici:
<?php
$db_host="localhost";
$db_name="XXX";
$db_user="XXX";
$db_password="";
mysql_connect($db_host,$db_user,$db_password) or die("errore connessione");
mysql_select_db($db_name) or die("errore database");
$sql = "SELECT * FROM utenti ORDER BY nome";
$result = mysql_query($sql);
?>
<form action="cancella.php" method="post" name="form_delete">
<table border="1">
<tr>
<th>ID</th>
<th>Nome</th>
<th>Cognome</th>
<th>Indirizzo</th>
<th>Cap</th>
<th>Citta</th>
<th>Telefono</th>
<th>Email</th>
<th>Nato</th>
<th>Cancella</th>
</tr>
<?php
$count = mysql_num_rows($result);
for ($i=0; $i<$count; $i++){
$row = mysql_fetch_array($result);
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['nome']; ?></td>
<td><?php echo $row['cognome']; ?></td>
<td><?php echo $row['indirizzo']; ?></td>
<td><?php echo $row['cap']; ?></td>
<td><?php echo $row['citta']; ?></td>
<td><?php echo $row['telefono']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['nato']; ?></td>
<td style="text-align:center;"><input type="checkbox" name="cancella_<?php echo $i;?>" value="<?php echo $row['id']; ?>"></td>
</tr><?php }?>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="text-align:center;"><input type="hidden" name="totale" value="<?php echo $count; ?>"><input type="submit" value="Cancella"></td>
</table>
</form>
<?php
mysql_close();
?>
cancella.php:
<?php
$db_host="localhost";
$db_name="my_fantaminei";
$db_user="fantaminei";
$db_password="";
mysql_connect($db_host,$db_user,$db_password) or die("errore connessione");
mysql_select_db($db_name) or die("errore database");
$totale = $_POST['totale'];
for ($i=0; $i<$totale; $i++){
if (!empty($_POST['cancella'.$i])){
$delete = "delete from utenti where id = ".$_POST['cancella'.$i];
mysql_query($delete);
}
}
?>
![]()