I have a form that collects data from a few different fields and saves it to a csv file in the normal manner of newest record at the bottom of the csv. However what I really need it to do is write the data to the top of the csv if possible. I have a page that manages the data and saves it to the csv for me. The script is listed here. Any help would be awesome and much appreciated.
[php]
<?php $mm = $_POST['mm']; $dd = $_POST['dd']; $yy = $_POST['yy']; $name = $_POST['name']; $comment = $_POST['comment']; $fp = fopen("datafeed/filetoread.csv", "a"); $savestring = $mm . " " . $dd . " " . $yy . " " . $name . " " . $comment . "\n"; fwrite($fp, stripslashes($savestring)); fclose($fp); echo "Your data has been saved
"; ?>[/php]