How can I avoid the the browser form-resubmission alert?
This question seems to have been discussed a lot here on SO, for example:
- Preventing form resubmission
- Prevent Back button from showing POST confirmation alert
- Never ever respond with a body to a POST-request
What I do not get from the previous discussion, is how I can use the posted data and incorporate it into the html. The previous links discuss how to use the php header function to send a get
request to itself. But when sending this get
request, the posted data will no longer be available to the new page, (since we cannot use the php post method..)
I would like to do this without using the php
or javascript
session storage technique (or saving the posted data to a temporary mySQL database).
For a simple example:
<html>
<body>
<form action="post.php" method="post">
User name: <input type="text" name="user"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
where post.php
is:
<html>
<body>
<?php
echo "<p>".$_POST['user']."</p>";
?>
</body>
</html>
Pressing CTRL-R in google chrome on the second page brings up the alert.