The technology of deleting Articles in batches is not profound. I just want to write it down and share it with you. (Suitable for beginners :)
1. On the article list page (list. php), name the multiple baskets "$ del_id []" and set the value to the Article ID.
For example (list. php ):
<Form name = "del_form" action = "del. php" method = "post">
<? Php
$ Result = mysql_query ("select * from news ");
While ($ rs = mysql_fetch_array ($ result )){
?>
<Input name = "del_id []" type = "checkbox" id = "del_id []" value = "<? = $ Rs [id]?> "/> <? = $ Rs [title]?>
<? Php
}
?>
</Form>
2. Processing page (del. php ):
<? Php
If ($ del_id! = ""){
$ Del_num = count ($ del_id );
For ($ I = 0; $ I <$ del_num; $ I ++ ){
Mysql_query ("Delete from news where id = '$ del_id [$ I]'");
}
Echo ("<script type = 'text/javascript '> alert ('deleted successfully! '); History. back (); </script> ");
} Else {
Echo ("<script type = 'text/javascript '> alert (' select a project first! '); History. back (); </script> ");
}
?>