Php表单发布超过500个POST参数

时间:2016-10-03 09:19:38

标签: php http-post

我试图发布一个包含500多个数据字段的php表单。我尝试通过jquery序列化表单数据,然后提交表单。我也得到了相同的结果。任何人都可以帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

您可以使用JQuery发布一个和一个值,然后将值保存在会话数组中。

在您的首页,您可以这样做:

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
    function update_post(){
        $("#/*Text Input ID Name*/").load("update_post_session.php?name=(session_array_name)&group=(session_name)&value="+ document.getElementById('Text Input ID').value.split(" ").join("_")); // .split(" ").join("_") does replace ALL spaces with underscores, this line can be used more times with different ID and value and name etc
    }
    // To update the session automaticly
        setInterval(update_post, 10000); // This will update the form each 10 seconds, if you have over 500 inputs I would recommend minimum 5 seconds so it will not cause the client to experience any downtime to form
</script>

在你的update_post_session.php中,你将拥有:

<?php
    session_start();
    $session_group = $_GET['session_name'];
    $session_name  = $_GET['name'];
    $value = $_GET['value'];
    /*Replacing "_" with " "*/ $value = str_replace("_", " ", $value);
    $_SESSION[$session_group][$session_name] = $value;
?>

修改

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
    function update_post(stop){var id = 0;
        var whileinter = setInterval(function(){
            if(id>stop){clearInterval(whileinter);}
            $("#"+id).load("update_post_session.php?name=(session_array_name)&group=(session_name)&value="+ document.getElementById('Text Input ID').value.split(" ").join("_")); // .split(" ").join("_") does replace ALL spaces with underscores, this line can be used more times with different ID and value and name etc
            id++;
        }, 1);
    }
    // To update the session automaticly
         var inter = setInterval(update_post(500 /* the amount of input boxes you have */), 10000); // This will update the form each 10 seconds, if you have over 500 inputs I would recommend minimum 5 seconds so it will not cause the client to experience any downtime to form
</script>

在你的html中输入表格,无论你将从0到表格的数量,发布BY ORDER(0 1 2 3 4 5 6 7 8 9 10 ... 20 ... 50 ... 200。 .. 500&lt; - END)