删除前添加确认删除弹出框

简单的很~

html页面

<a href ="你操作php删除文件的路径" onclick=" {if(confirm('你确定要删除<?php echo $v['username']?>吗?')){rentrn true;}return false;}">删除</a>

php文件

if($_GET['do']==del){
$id = $_GET['id'];
$sql = "delect from 数据库 where id = ".$id;
$dsql->ExecuteNoneQuery($sql);
    echo "<script> alert('删除成功!');window.location.href='student_voice.php';</script>";
}
原文地址:https://www.cnblogs.com/legendyang/p/3540118.html