<?php
include("../conn.php"); //包含conn.php文件
if(isset($_POST['id']) and isset($_POST['Submit']) and $_POST['Submit']=="删除"){
$delete=mysql_query("delete from lianxi where id='".$_POST['id']."'",$conn);
if($delete){
echo "<script> alert('删除成功!'); window.location.href='index.php'</script>";
}else{
echo "<script> alert('删除失败!'); window.location.href='index.php'</script>";
}
}
?>
弄好了一定给
<a href="shanchu.php?id=<?php echo $result['id'];?>">删除</a>
你说这样对吧 这样也不行呀,这样就一样都不能删了 你能把你的代码写给我一下吗
if(isset($_GET['id'])){
$delete=mysql_query("delete from lianxi where id='".$_GET['id']."'",$conn);
if($delete){
echo "<script> alert('删除成功!'); window.location.href='index.php'</script>";
}else{
echo "<script> alert('删除失败!'); window.location.href='index.php'</script>";
}
}