[英]PHP Javascript: Closing Popup calling parent window in background
Let's say a parent window is www.mysite.com/index.php
has several links. 假设一个父窗口是www.mysite.com/index.php
有几个链接。 When user clicks on these links, a popup is opened. 当用户单击这些链接时,将打开一个弹出窗口。
The popup has some forms. 弹出窗口具有某些形式。 When the user clicks submit button, another script is called within the popup like this: 当用户单击“提交”按钮时,将在弹出窗口中调用另一个脚本,如下所示:
if ((isset($_POST['Complete'])) && ($_POST['Complete']=='Complete')) {
unset($_POST['Complete']);
include 'result.php';
return;
}
The result.php
enters the data into database and pass the result to parent window with the following result.php
将数据输入数据库,并将结果传递给具有以下内容的父窗口
<script language="JavaScript" type="text/javascript">
window.opener.location.href = 'submission.php';
window.close();
</script>
The parent window then show the final result, update the master database and emails the users. 然后,父窗口将显示最终结果,更新主数据库并通过电子邮件发送给用户。
Now here is the problem. 现在这是问题所在。
null
values though). 但是主数据库正在更新,而用户正在接收电子邮件(尽管所有null
)。 Since the form was never completed, the result.php
should never be called. 由于表单从未完成,因此永远不要调用result.php
。 and if result.php
is never called, submission.php should never be called. 如果从不调用result.php
则永远不应调用result.php
。
What is happening here? 这是怎么回事
将关闭按钮的类型更改为button。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.