checkbox delete selected
Scris: Joi Feb 03, 2011
Cod: Selectaţi tot
<?
switch($_GET['actiune'])
{
case 'topics':
$sql="SELECT * FROM `poker` WHERE postid='' ";
$r=mysql_query($sql);
echo '<table cellpadding=10 cellspacing=10>';
echo '<tr><td width=50><b>User</b></td><td width=150><b>Titlu Topic</b></td><td><b>Data</b></td></tr>';
echo '</table>';
echo '<form method="post" action="poker.php?actiune=deleted">';
while($row = mysql_fetch_array($r)){
$data = time() + (7 * 24 * 60 * 60);
echo '<table cellpadding=10 cellspacing=10>';
echo '<tr><td width=50><b><a href=http://www.ro-gamblers.info/userinfo.php?user='.$row[0].'>'.$row[0].'</a></b></td><td width=150><a href=http://www.ro-gamblers.info/poker/viewtopic.php?id='.$row[5].'>'.$row[2].'</a></td><td>'.date('Y-m-d').'</td><td><input name=checkbox[] type=checkbox id=checkbox[] value="'.$row['id'].'"</td></tr>';
echo '</table>';
}
echo '<tr><td><input name="delete" type="submit" id="delete" value="Delete"></td></tr>';
echo '</form>';
break;
case 'deleted':
$sql5="SELECT * FROM `poker` WHERE `postid`='' ";
$r5=mysql_query($sql5);
$count=mysql_num_rows($r5);
if($delete){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql5 = "DELETE FROM poker WHERE id='$del_id'";
$r5 = mysql_query($sql5);
}
if($r5){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=poker.php?actiune=topics\">";
}
}
mysql_close();
break;
}
?>
dupa cum vedeti am selectat cateva linii din tabel si prin formular cu checkbox vreau sa sterg liniile selectate... insa nu-mi iese.. imi returneaza pagina poker.php?actiune=deleted .. insa nu ia nicio actiune si pagina e goala .. cam ce ar putea fi ?