test filewriting

This commit is contained in:
awesomeuser 2023-08-01 21:14:53 +00:00
parent 04fa281867
commit 04056f9184

View file

@ -38,14 +38,17 @@
<hr>
<?php
// read and display file
// write to file
$myfile = fopen("posts.txt", "a") or die("Unable to open file!");
fwrite($myfile, $_POST["signature"] . ": " . $_POST["body"] . "<br>");
fclose($myfile);
// read from file
$myfile = fopen("posts.txt", "r") or die("Unable to open file!");
echo fread($myfile,filesize("posts.txt"));
fclose($myfile);
?>
<br>you: <?php echo $_POST["signature"]; ?>
</div>
</body>