ho la seguente form:
Codice PHP:
$query = mysql_query("SELECT * FROM attack ORDER BY numattack DESC");
echo "Tentativi di attacco bloccati:
";
echo "<form action='index.php?act=attack&op=edit' method='post'>";
echo "<table align='center' border='1'>";
echo "<tr><td align='center'>IP</td><td>N° tentativi</td><td>Ban</td></tr>";
while($echo = mysql_fetch_array($query)){
echo "<tr><td>".$echo[1]."<td align='center'>".$echo[3]."</td><td align='center'>";
if($echo[2] == 0){echo "<input type='checkbox' name='".$echo[0]."'>";}
else{echo "<input type='checkbox' name='".$i."' checked>";}
echo "</td></tr>";
}
che rimanda a questo script
Codice PHP:
$query = mysql_query("SELECT COUNT(*) FROM attack");
$echo = mysql_fetch_array($query);
for($i = 1; $i <= $echo[0]; $i++){
if($_POST[$i] == false){$ban = 0;}
else{$ban = 1;}
mysql_query("UPDATE attack SET ban='".$ban."' WHERE id='".$i."'");
}
echo "Aggiornamento ban effettuato con successo.";
la checkbox e' spuntata quando e' effettivamente 1 nel database, ma quando lascio inalterate le checkbox spuntate automaticamente e clicko su modifica quando torno sulle checkbox sono non spuntate, e nel db il valore e' 0
che sia un problema di browser o di php che non riconosce come true le checkbox con attributo checked ?