I want to Add new data at the starting of my text file. Dats is coming dynamically.
Below is the code i have try so far :
if(isset($_POST["posten"])){
$naam = $_POST['naam']."ø";
$achternaam = $_POST['achternaam']."ø";
$email = $_POST['email']."ø";
$bericht = $_POST['bericht']."\n";
$infile = fopen("berichten.txt","a");
if (flock($infile,LOCK_EX)){
fwrite($infile, $naam);
fwrite($infile, $achternaam);
fwrite($infile, $email);
fwrite($infile, $bericht);
flock($infile,LOCK_UN);
}
fclose($infile);
}