2014-05-11 95 views
0

我在TPL代碼:POST不工作正確

<form action="build.php?id={id}" method="post"> 
    <input width="80" type='submit' height='20' value='{uzsakyti_svente}' name='uzsakyti1'> 
    </form> 

當我按下按鈕動作時,會自動在行動已經結束頁面刷新和Firefox彈出走了出來,讓我重新加載頁面之間選擇取消,現在這是我不希望的問題,當行動完成頁面只是刷新,但Firefox表或其他瀏覽器的表不會出來,現在任何想法如何做到這一點?

+0

你在你的built.php腳本中使用重定向?看起來您的腳本會刷新您的頁面,並且通過Post請求,導航器會指示您再次發送數據。 –

+0

是的build.php是我在這種情況下執行操作的相同文件嗎? – user3621791

+0

發佈您的build.php代碼 – Colum

回答

0

重定向到您的網頁,如果趕上POST請求,在您的build.php文件:

if (! empty($_POST)) 
{ 
    // Update or insert your data in DB or whatever ... 

    if ($data_ok) 
    { 
     header('HTTP/1.1 303 See Other'); 

     // You can add a param to display in your view that the form was posted 
     header('Location: http://domain.com/build.php?posted=1'); 
     exit(); 
    } 
} 

// Your main code goes here ... 
+0

謝謝你,我會選擇這個答案! – user3621791