Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 表单提交导致多个请求加载同一页面_Php_Html - Fatal编程技术网

Php 表单提交导致多个请求加载同一页面

Php 表单提交导致多个请求加载同一页面,php,html,Php,Html,在HTML表单上,用户填写注册数据,然后将其提交到PHP页面以处理POST数据。大约20%的时间,当用户单击“提交”时,POST数据为空。使用Fiddler进行的一些调查表明,当它正常工作时: 58 200 HTTP www.awebsite.com /?page_id=337 22,433 no-cache, must-revalidate, max-age=0; Expires: Wed, 11 Jan 1984 05:00:00 GMT text/html; ch

在HTML表单上,用户填写注册数据,然后将其提交到PHP页面以处理POST数据。大约20%的时间,当用户单击“提交”时,POST数据为空。使用Fiddler进行的一些调查表明,当它正常工作时:

58  200 HTTP    www.awebsite.com    /?page_id=337   22,433  no-cache, must-revalidate, max-age=0; Expires: Wed, 11 Jan 1984 05:00:00 GMT    text/html; charset=UTF-8    firefox:9116                    
当它破裂时,我看到:

56  200 HTTP    www.awebsite.com    /?page_id=337   144 no-store, no-cache, must-revalidate, post-check=0, pre-check=0; Expires: Sat, 6 May 1995 12:00:00 GMT       firefox:9116            
57  200 HTTP    www.awebsite.com    /?page_id=337   144 no-store, no-cache, must-revalidate, post-check=0, pre-check=0; Expires: Sat, 6 May 1995 12:00:00 GMT       firefox:9116            
58  302 HTTP    www.awebsite.com    /?page_id=337   16,561  no-cache, must-revalidate, max-age=0; Expires: Wed, 11 Jan 1984 05:00:00 GMT    text/html; charset=UTF-8    firefox:9116            
59  200 HTTP    www.awebsite.com    /?page_id=445   19,989  no-cache, must-revalidate, max-age=0; Expires: Wed, 11 Jan 1984 05:00:00 GMT    text/html; charset=UTF-8    firefox:9116    
这就像提交是提交页面三次。顺便说一句,HTML和PHP页面是WordPress网站的一部分……不确定这两者是否密切相关,但希望包含尽可能多的信息

对发生的事情有什么想法吗?我是否因事件冒泡而有罪?如果有帮助的话,我很乐意展示代码,如果没有必要的话,我不想把地方弄得乱七八糟

根据评论进行编辑: 首先感谢FDinoff做了格式化…我边走边学,希望这能奏效。(八^)

为了:

@3dgoo:我很小心只点击了一次提交,所以我认为这不是问题所在。但愿如此

@杰里恩:这是断断续续的,多好的一个PITA,但是我可以通过提交四五次页面来实现它……它会实现的

@爱德华多:是的,正如你在我对@meewoK的回复中所看到的,这正是我正在做的

@米渥:你的愿望就是我的命令,先生!以下是我的HTML中的表单标记:

当代码失败时,
$\u POST
数组为空,用户将被重定向到通知错误的页面。这是
页面的id=445


谢谢大家,你的想法和建议会让我朝正确的方向思考。

你可以为每一篇文章添加验证码。。因此,当它多次单击时,它将生成一个新的验证码并返回false


希望有帮助

是否有可能多次按下“提交”按钮?您能自己重现该问题吗?术语
事件冒泡
表示ajax/javascript提交,您是否同时进行客户端和服务器端验证?可能您正在这样做:
Submit
最好从包含表单+javascript的特定HTML代码中看到更多代码
<form  class="contact_form" action="/?page_id=337" method="post" name="contact_form" onsubmit="return validateForm();">
<?php
/*
Template Name: DisplaySummaryToApplicant.php
*/
?>

<?php
$ipaddress = $_SERVER["REMOTE_ADDR"];
if (count($_POST) == 0 ) {
    header("location: http://www.awebsite.com/?page_id=445");
}
require('wp-load.php');
get_header("header_reg"); 
//echo '<meta http-equiv="expires" content="0">'; 
require_once (dirname(__FILE__)."/dbLog.php");

global $current_user;
get_currentuserinfo();