<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><thead> <li> <tr> <li> <th><input class="check-all" type="checkbox"></th> </li> <li> <th>ID</th> </li> <li> <th>Name</th> </li> <li> </li> </tr> </li> <li> </thead></li> <li><tbody> <li> <?php foreach($adminlist as $arritem)<li> {</li> <li> ?></li> <li> <tr> <li> <td> <li> <input name="select[]" value="<?php echo $arritem['id'];?>" type="checkbox"> //这里的name很重要,到delete.php中会调用</li> <li> </li> </td> </li> <li> <td><?php echo $arritem['id'];?></td> </li> <li> <td><?php echo $arritem['name'];?></td> </li> <li> </li> </tr> </li> <li> <?php <li> }</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> <li>mysql_select_db("dbname"); </li> <li>$id=$_POST['select']; //调用input的name</li> <li>foreach($id as $ide){ </li> <li>$exec="delete from tablename where sID=$ide"; </li> <li>$result=mysql_query($exec); </li> <li>if((mysql_affected_rows()==0) or (mysql_affected_rows==-1)) </li> <li>{ </li> <li>echo "没有找到记录,或者删除时出错"; </li> <li>exit; </li> <li>} </li> <li>else{ </li> <li>echo "学生信息已经删除"; </li> <li>} </li> <li>} </li> <li>mysql_close(); </li> <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>