Hy , let's get straight to the problem here , i need a loop code to process and delete all submited chekbox'es ids / by submit form
queryes preview list
PLEASE HELP ME OUT ! i already tried some google found' examples non worked !
if you got any working example that doesn't use register_globals=on and can delete multiple "rows" from database, please post !!
tnx
Added after 3 minutes:
i know that the name="checkbox" should be like name="checkbox[]" but i don't know how the hell should be codded////
queryes preview list
PHP Code:
<?php
include'include/functie.php';
$query=mysql_query("SELECT * FROM table_postblog WHERE user='username' ");
$num_rows = mysql_num_rows($query);
if ($_GET['cmd']=="delete"){
echo'<form name="form1" method="post" action="blog.php?cmd=delchecked">';
// loop through the query's and list
while($rows=mysql_fetch_array($query)){
echo'<input name="checkbox" type="checkbox" value="'.$rows['idul'].'">
'.$rows['postname'].'<br/>
'.$rows['date'].'<br/>';
}
echo'<input name="delete" type="submit" value="delete"></form><br/>';
//echo "".$num_rows." posts";
}
if($_GET['cmd']=="delchecked"){
// need the loop code to delete all submited id's ???
the_loop_here(){
$result = mysql_query("DELETE FROM table_postblog WHERE idul='".$removeid."'");
if ($result){echo"succesfully deleted <br/>";}
else if (!$result){echo"sorry can't be deleted"; exit;}
else{echo"system error";}
}
}
?>
if you got any working example that doesn't use register_globals=on and can delete multiple "rows" from database, please post !!
tnx
Added after 3 minutes:
HTML Code:
<form name="form1" method="post" action="blog.php?cmd=delchecked"><input name="checkbox" id="checkbox" type="checkbox" value="11"> Real football 2012<br/> 04/09/2011<br/><input name="checkbox" id="checkbox" type="checkbox" value="12"> De ce sa folosesti uppy.me?<br/> 06/09/2011<br/><input name="checkbox" id="checkbox" type="checkbox" value="15"> Admob Suge <br/> 06/09/2011<br/><input name="checkbox" id="checkbox" type="checkbox" value="17"> Nimic #7<br/> 06/09/2011<br/><input name="checkbox" id="checkbox" type="checkbox" value="18"> Hostgator<br/> 06/09/2011<br/><input name="checkbox" id="checkbox" type="checkbox" value="20"> <input name="delete" type="submit" id="delete" value="delete"></form>
Comment