I have tried everything, and multiple different source codes, I have tried creating the file so all the PHP had to do was write in it, and still unable to do it.
This is my HTML on index.html
<form name="userinput" action="usersave.php" method="post">
Your name: <input type="text" name="username><br>
Your email: <input type="text" name="useremail"><br>
Your story: <textarea rows="3" cols="50" name="userstory"></textarea><br>
<input type="submit" value="Submit!" name="submit">
</form>
And this is my PHP on usersave.php
<header>
<?php
$file = 'output.txt';
$buffer = $_POST['userstory'];
if (file_exists($file)) {
$buffer = file_get_contents($file) . "\n" . $buffer;
}
$success = file_put_contents($file, $buffer);
?>
</header>
any help is appreciated, please and thank you.