表格发送

时间:2016-04-25 13:30:52

标签: php html forms post put

我正在一个有问题的网站上工作。它是一个PHP脚本,可以从数据库中读取问题,并根据您的答案显示一些内容。用户将单击一个答案,页面将重新加载重新发布先前输入的表单数据,以便已经回答的问题将显示已选中答案的已禁用按钮/收音机表单。

我在调试过程中注意到以前发送的东西没有被清除并且总是被重新发布(但页面有效,我认为它看起来不干净)

例如: ?位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2及p_item5 = 2及p_item6 = 2及p_item7 = 2及p_item8 = 1&安培;位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2及p_item5 = 2及p_item6 = 2及p_item7 = 2及p_item8 = 1&安培;位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2及p_item5 = 2及p_item6 = 2和; p_item7 = 2及p_item8 = 1&安培;位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2及p_item5 = 2及p_item6 = 2及p_item7 = 2及p_item8 = 1&安培;位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2及p_item5 = 2及p_item6 = 2及p_item7 = 2及p_item8 = 1&安培;位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2和; p_item5 = 2及p_item6 = 2及p_item7 = 2及p_item8 = 1&安培;位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2及p_item5 = 2及p_item6 = 2及p_item7 = 2及p_item8 = 1&安培;位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2及p_item5 = 2及p_item6 = 2及p_item7 = 2&一个熔点; p_item8 = 1&安培; p_item9 = 2及位置= 9&安培; p_item1 = 4和; p_item2 = 2及p_item3 = 4和; p_item4 = 2及p_item5 = 2及p_item6 = 2及p_item7 = 2及p_item8 = 1#LASTROW

如何摆脱post / put数据呈指数级变大?

1 个答案:

答案 0 :(得分:0)

我假设您所指的“答案”是一个链接。如果是这样,您可以轻松使用$ _POST超全局发送数据:

<!-- javascript that creates the post() function-->
<script>
    function post(event) {
        event.preventDefault();
        document.getElementById("my_form").submit();
    }
</script>

<!-- form with the information you want to post-->
<form action="action.php" method="post" id="my_form" style="display: none;">
<?php 
    /*You'll have to create the needed php code that will echo the
    hidden inputs for the form that should look like this:
        <input type="hidden" name="position" value="9" />
        <input type="hidden" name="p_item1" value="4" />
        ... and so on.*/
    ?>    
</form>

<a href="#" onclick="post()">Your Link</a>