Heim > Artikel > Backend-Entwicklung > 删除前添加确认删除弹出框_PHP教程
简单的很~
html页面
<span <</span><span a </span><span href </span><span ="你操作php删除文件的路径"</span><span onclick</span><span =" {if(confirm('你确定要删除<?php echo $v['username']?>吗?')){rentrn true;}return false;}"></span><span 删除</a</span><span ></span>
php文件
<span if</span>(<span $_GET</span>['do']==<span del){ </span><span $id</span> = <span $_GET</span>['id'<span ]; </span><span $sql</span> = "delect from 数据库 where id = ".<span $id</span><span ; </span><span $dsql</span>->ExecuteNoneQuery(<span $sql</span><span ); </span><span echo</span> "<script> alert('删除成功!');window.location.href='student_voice.php';</script>"<span ; }</span>