I am having a problem with firefox and a form web page. The same problem does not occur with chrome. When the user submits the form with required fields empty an error page is shown with a "go back"-button. If the User goes back the form is empty in firefox.
Now I want to ensure that this does not happen. I found this code: How to keep changed form content when leaving and going back to HTTPS page? (works with HTTP)
But I do not understand how to get it working.
I also found this Mozilla Firefox form values reset on history.back
Which is basically a copy of my question, but I need a full working example of the proposed solution "capture your POST data and turn it into SESSION variables, then repopulate input fields on browser back".
Here a webpage for testing that show the code in use: http://s659173456.online.de/
However it does not show the problem in firefox nor chrome. Nevertheless I want to include a restorage of the input values using session variables.
EDIT: I added a session restorage:
<?php session_start(); ?>
....
<input class="flatinput" type="text" size="40" name="Nachname"
value="<?php echo (isset($_SESSION['Nachname']) ? $_SESSION['Nachname'].'restored' : ''); ?>"
/>
and in the php file for the evaluation
function process_anmeldeformular() {
// save POST as SESSION
if(isset($_POST)) {
foreach ($_POST as $key => $val) {
if( ($val != "submit") && !empty($val) ) {
$_SESSION["$key"] = $val;
}
}
}
But that does not solve the problem.