在index.php中:
function doDel(id){
if(confirm("确认删除?")){
window.location="action.php?action=del&id"+id;
}
}
以及
在action.php中:
case 'del':
$id = $_GET['id'];
$sql = "delete from stu where id='$id'";
$rw = mysqli_query($conn,$sql);
if ($rw > 0){
echo "";
}else{
echo "";
}
header('Location: index.php');
break;
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
id没传过去吧,&id="+id