<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_17553"> <div class="blockcode"> <div id="code_a71"><ol> <li><form action="delete.php" method="post"></li> <li><thead></li> <li> <tr></li> <li> <th><input class="check-all" type="checkbox" /></th></li> <li> <th>ID</th></li> <li> <th>Name</th></li> <li> </tr></li> <li></thead></li> <li><tbody></li> <li> <?php foreach($adminlist as $arritem)<li> {<li> ?></li> <li> <tr> </li> <li> <td></li> <li> <input name='select[]' value="<?php echo $arritem['id'];?>" type="checkbox" /> //这里的name很重要,到delete.php中会调用</li> <li> </td></li> <li> <td><?php echo $arritem['id'];?></td></li> <li> <td><?php echo $arritem['name'];?></td></li> <li> </tr></li> <li> <?php<li> }<li> ?></li> <li></tbody></li> <li> <input type="submit" value="Delete all selected" onclick="javascript:return confirm("Are you sure?")"/></li> <li></form></li> <li> <li>delete.php</li> <li><?php<li>$link=mysql_connect("localhost","root",""); <li>mysql_select_db("dbname"); <li>$id=$_POST['select']; //调用input的name<li>foreach($id as $ide){ <li>$exec="delete from tablename where sID=$ide"; <li>$result=mysql_query($exec); <li>if((mysql_affected_rows()==0) or (mysql_affected_rows==-1)) <li>{ <li>echo "没有找到记录,或者删除时出错"; <li>exit; <li>} <li>else{ <li>echo "学生信息已经删除"; <li>} <li>} <li>mysql_close(); <li>?></li> </ol></div> <em onclick="copycode($('code_a71'));">复制代码</em> </div> </td></tr></table> <div id="comment_17553" class="cm"> </div> <div id="post_rate_div_17553"></div> <br><br>