的情况是,当我的X光图像上单击旁边的tour_manage.php的记录,这将删除由被称为delete_tour.php确认删除图片的消息框?
我已成功地添加弹出另一个PHP页面执行记录框到X图像,当我点击X时,消息框出现说OK(确定)以删除或取消。但是,问题是当我点击确定和/或取消时,两个按钮都会删除记录。
请帮忙!
这些是我得到的两个脚本。 第一个脚本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');
}
?>
回报从JavaScript处理虚假 – Ejaz 2013-04-27 01:17:10
对不起这是什么意思? – munue 2013-04-27 01:18:47
尝试在函数redirect(){'}的'}之前放置'return false;'。我认为它会解决你的问题 – Ejaz 2013-04-27 01:20:41