You need to use the PRG template - Post / Redirect / Get. Redirecting and viewing the load do not match if you have a form in the content of the page.
Scenario:
There is a view, view_1 with a form in it for debit money from an account. After submitting the form in view_1, you want to go to view_2 with a successful message, and you have 2 options to achieve the same. 1. load view_2 with a success message, or 2. redirect to view_2 with a message about the successful execution of flash data.
Option 1: load view_2 with a successful message When you submit a form and update it, it causes a resubmission and causes a multiple debit from the account, which should not be. You can also see a message about the warning “Confirm re-submit form”.
Option 2: This is the correct PRG answer
PRG - message / forwarding / receiving PRG is a web development design template that prevents some duplicate forms, which means Send form (view_1) → Redirect → Get (view_2)
Under the hood
The redirection status code is HTTP 1.0 with HTTP 302 or HTTP 1.1 with HTTP 303
An HTTP response with a redirect status code will additionally provide a URL in the location header field. The user agent (for example, a web browser) is prompted with an answer with this code to make a second, otherwise identical request to the new URL specified in the location field.
The redirection status code is designed to ensure that in this situation, the web user's browser can safely update the server response without causing the original HTTP POST request to be resent.
A source
Double Submit Problem

Post/Redirect/Get Solution

Angelin nadar
source share