I am running a simple test and would like to know if there is any way to clear the form data if the user gives refresh
to the browser.
<?php
$test1 = "";
$test2 = "";
if($_SERVER["REQUEST_METHOD"] == "POST")
{ $test1 = $_POST['test1'];
$test2 = $_POST['test2'];
}
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<input type="text" name="test1" value="<?php echo $test1;?>"/>
<input type="text" name="test2" value="<?php echo $test2;?>"/>
<input type="submit" name="btn_sub" value="Enviar" />
</form>
Whenever I type something in the fields if I give refresh
in the browser the data remains.
I would like to know if you can clear these fields by clicking on the browser refresh.