Hi. I have a form which submits field values to a database. The process of writing to the database is in the same file as the form itself. If the form has been submitted, the data is written, if not, the form is shown.
This has been working fine, but if the user submits the form, then presses the refresh button on their browser, the data is written twice.
What i would like to do, is use
[code=php]header(‘location: http://’ . $_SERVER[‘SCRIPT_NAME’]);
to redirect to the same page on successfull data submission, so if the user presses refresh, it doesn’t matter. However, this obviously fails, as the $_POST data is carried forward with the redirect.
Is there a way to use this redirect, but to drop all POST data in the process? This is the case if i redirect to a different page, but POST data is still present when redirecting to the same page.
Any help would be appreciated.