2016-04-25 67 views
0

我正在一個有問題的網站上工作。這是一個PHP腳本,它從數據庫中讀取問題並根據您的答案顯示一些內容。用戶將點擊一個答案,該頁面將重新發布之前輸入的表單數據,因此已經回答的問題將顯示已禁用的按鈕/電臺表單並且檢查了答案。 ? 位置= 9 & p_item1 = 4 & p_item2 =:重新加載頁面上的html表單沒有清除表單發送

我調試之前發送的東西是不會被清除,並始終轉貼(頁作品不過,我只是覺得它看起來不乾淨)期間

例如注意到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

我該如何擺脫後/放數據成倍增長?

+0

使用會話,並張貼 – Naruto

+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> 
+0

沒有答案是一個形式無線電「onchange」元素和以前回答的問題beeing轉發 for($ counter = 1; $ counter <$ position; $ counter ++){if($ {'p_item'。$ counter };}!=「」){print(「 \ n」); }} 但是它重新發送之前發佈的項目 –

相關問題