我建议使用Ajax “删除=(ID)?”。在这里,我将使用jQuery使用
$(function() {
$(".wh").on("click",function(e) {
e.preventDefault(); // cancel the click
$.get(this.href,function(data) { // does the student still exist?
if (confirm("delete" +data+"?")) {
$.get("otherphp.php?st_id="+$(this).data("id"),function(data) {
$(this).next().html(data); // show response
});
}
});
});
});
做
<a class="wh" data-id="<?=$rows['student_id']?>" href="edit-mark.php?st_id=<?=$rows['student_id']?>" title="Edit">Edit Marks</a><span class="confirmation"></span>
或者隐藏从蜘蛛
在href
<a class="wh" href="onlyworkswithjavascript.html"
data-id="<?=$rows['student_id']?>" data-href="edit-mark.php?st_id=<?=$rows['student_id']?>"
title="Delete">Delete Marks</a><span class="confirmation"></span>
$(function() {
$(".wh").on("click",function(e) {
e.preventDefault(); // cancel the click
if (confirm("delete" +data+"?")) {
$.get($(this).data("href"),function(data) {
$(this).next().html(data); // show response
});
}
});
});
1:从来没有一个调用删除链接 - 从一个访问Google蜘蛛和你的数据库是空的。 2.使用方法Ajax请求:“DELETE”并显示返回消息 – mplungjan
请不要再使用'mysql_ *'函数。它们在PHP5中被弃用,并在PHP7中被删除。使用MySQLi或PDO准备语句来防止mysql注入。 – Jer
@mplungjan如果删除身份验证部分后面,则没有任何问题。 – tilz0R