how can i append text the the top of a .txt file?
I’ve set up a post a view of the text file but the way i’m laying it out is that when I post it needs to be placed at the top of the document.
here’s the code:
<?php
$filename = $_POST["filename"];
$header = $_POST["header"];
$content = $_POST["content"];
$footer = $_POST["footer"];
$data = fopen($filename, "a");
fwrite($data,$header);
fwrite($data,"|");
fwrite($data,$content);
fwrite($data,"|");
fwrite($data,$footer);
fwrite($data,"
");
fclose($data);
echo '
Done!<br>Click <a href="view.php">here</a> to view the file.
';
?>
I just need to be able to post to the top. nothing simple but i’m a n00b so in patronising terms would be good