If you want to create a new file every day, you can create a txt file with the current date date('dm-Y').".txt" . therefore, you can easily identify the file by date.
try under the code, I made some changes to the code and tested it.
<?php $dateFile = date('dm-Y').".txt"; $dataString = "name:" . $name . "age:" . $age."\n"; $fWrite = fopen($dateFile,"a"); $wrote = fwrite($fWrite, $dataString); fclose($fWrite); print "file created and written to"; ?>
If the file has already been created, so you can save the new entry in a new line "\n" , \ n should be in "" quatoed.
source share