Well, I set up a very simple form
to explain my problem.
<?php
$action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT);
if ((!empty($action)) && ( $action === "add")) {
?>
<script>
alert('ERRO');
window.history();
</script>
<?php
}
?>
<form action="form.php?action=add" method="post">
<input type="text" name="nome">
<input type="text" name="email">
<input type="password" name="senha">
<input type="submit" name="enviar" value="enviar" />
</form>
When there is an error in my form I send a alert
to the user and it is redirected to the previous page to correct the error. The problem is that all form data is lost when it returns. Is there any way to resolve this? A way in which data is kept and only deleted when the form is correct?