Hi, dim question I think but can someone tell me how to make the following start a new line each time it writes to the text file... <?php $myFile = "information.txt"; $fh = fopen($myFile, 'a'); $stringData = $_GET['id']; $stringDate = date('dS F Y'); fwrite($fh, $stringData); fwrite($fh, $stringDate); fclose($fh); ?> I tried adding \n but it didn't seem to work... Cheers!
\n should work. $stringData = "{$_GET['id']}\n"; $stringDate = date('dS F Y') . "\n"; PHP: If that doesn't work, try \r\n instead.
\n is for *nix, \r\n is for Windows. So, unix version: $myFile = "information.txt"; $fh = fopen($myFile, 'ab'); //<- read about 'b' flag at http://php.net/fopen $stringData = $_GET['id']; $stringDate = date('dS F Y'); fwrite($fh, $stringData."\n"); fwrite($fh, $stringDate."\n"); fclose($fh); PHP: