here is the html/php
<html>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"] ?>">
Enter message<br> <textarea rows="4" cols="40" name="form"></textarea><br>
<input type="submit">
</form>
<?php
$formvalue = $_POST["form"];
if ($formvalue == TRUE) {
$file = fopen("logindetails", "a");
fwrite($file, PHP_EOL);
fwrite($file, $formvalue);
fclose($file);
}
else {
die();
}
?>
</html>
Now whenever I reload the page the previously submitted value or a new line break appears How do I solve this
Please help
I expected the form value from the webpage to be submitted and displayed on a file on the server and with each form submit the file to be updated but instead it repeats the previously sent value onto the file with page refresh or if I haven't filled in anything in the form a blank new line as I added a
attribute to my form