日期:2014-05-17 浏览次数:20633 次
<?php
#test.php
if(isset($_POST['id2'])){
    $sql="delete from table where id=".trim($_POST['id2']);
    $res = mysql_query($sql);
    if(!$res)
        die("SQL:{$sql}<br>Error:".mysql_error());
    if(mysql_affected_rows() > 0){
        echo "删除成功!<br>";
    }else{
        echo "查询失败<br>Error:".mysql_error();
    }
}
?>
<form id="form3" name="form3" method="post" action="test.php">
  <p>
  <label for="id2">删除序号为</label>
  <input name="id2" type="text" id="id2" size="10" value="3" />
  的记录
  </p>
  <p>
  <input type="submit" name="del" id="del" value="删除" />
  </p>
</form>