0

My workaround getting the "Resubmit post data" dialog when users refresh, and respectively sending stuff twice, was to force a refresh on the page via javascript when content is posted. Which seemed to work in webkit browsers and IE but unfortunately firefox doesn't work that way.

The problem is that after the post I need the user to be returned to the same page which kinda confused me on using the post/redirect/get method since it is described there that another page needs to be supplied. Even if I send a redirect header from php itself firefox still asks about resubmitting. Can anyone suggest how I can solve this problem? Thank you in advance!

EDIT: Here's some code

if($_SERVER['REQUEST_METHOD']=="POST"){
    $user->validateSettingsData($_POST, TRUE);
    echo "<div class='win box10'>Changes saved, please wait..</div>";

    header("Refresh: 2; url=");
    exit();
}
4

1 回答 1

1

您可以使用 PHP 进行重定向。例如:

if (isset($_POST)) {
    // processing the data
    // ....

    header('LOCATION: ' . $_SERVER['REQUEST_URI']); // <-- for dynamic URL
    exit();
}
于 2013-08-29T15:44:13.993 回答