在index.php:
<script>
function doDel(id){
if(confirm("確認刪除?")){
window.location="action.php?action=del&id" id;
}
}
</script>
#以及
<a href='javascript:void(0);' onclick='doDel({$row['id']})'>刪除</a>
在action.php:
case 'del':
$id = $_GET['id'];
## $ sql = "delete from stu where $ id='$id'"; $rw = mysqli_query($conn,$sql); if ($ltw > 0){ if ($ltw > 0){ ;script>alert('刪除成功');</script>"; }else{ echo "<與失敗); script>"; } header('Location: index.php');o#