[英]confirmation delete message box for an image?
场景是当我单击tour_manage.php中记录旁边的X图像时,这将删除该记录,该记录由另一个名为delete_tour.php的php页面执行。
我设法将弹出框添加到X图像中,当我单击X时,出现消息框,提示确定要删除或取消。 但是,问题是当我单击“确定”和/或“取消”时,两个按钮都删除了记录。
请帮助!
这些是我得到的2个脚本。 第一个脚本是tour_manage.php,第二个脚本是delete_tour.php
<script type="text/javascript">
function confirm() {
if(r == true) {
window.location='delete_tour.php;
} else {
window.location='tour_manage.php';
}
}
</script>
<a href="delete_tour.php?tid=<?php echo $tid ?>" onclick="return confirm('Are you sure you want to delete this tour?');" ><img src="images/delete
logo icon.png" width="15" height="15"/></a></td>`
这是delete_tour.php脚本
<?php
session_start();
include('../config.php');
$id=$_GET['tid'];
$sql=mysql_query("delete from tour where tid='$id' ");
if($sql)
{
header('location:tour_manage.php');
}
?>
更新
<a onclick="return confirm('Are you sure you want to delete this tour?')" href="delete_tour.php?tid=<?php echo $tid ?>">aaa</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.