可能重複:
Avoid resending forms on php pages當PHP頁面被刷新,瀏覽器會彈出一條消息,用戶
的Index.html
<form method="post" action="demo.php">
<input type="text" name="fname"/>
<input type="text" name="lname"/>
</form>
演示。 PHP
<?php
$firstname = $_POST['fname'];
$lastname = $_POST['lname'];
//some more php code to fill the webpage
?>
因此,用戶輸入他的名字和姓氏,並提交表單,然後demo.php它的工作,其工作正常,但是當我按F5或下一次我得到這個刷新demo.php從瀏覽器彈出
// this message is from google chrome
the page that you're looking used information that you entered.
Returning to that page might cause any action to be repeated.
Do you want to continute?
// this message is from IE 7 or 8
To display the webpage again,Internet Explorer needs to resend information
you've previously submitted. If you were making a purchase,
you should click cancel to avoid duplicate transaction,else click retry.
爲什麼我得到這個?我只想刷新頁面。我不希望該消息從瀏覽器中彈出。根據之前提交的值刷新頁面,因爲它在我的數據庫中創建重複值。