Appending to the end of a file
| From: | Matt Greene | Date: | Sat, 04 Dec 1999 06:26:29 +0000 |
| Subject: | Appending to the end of a file | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-7382@lists.php.net to get a copy of this message | ||
Ok heres my situation, I am trying to append to the end of a with a form,
but when it appends it just appends it onto my last line of my file which
already has data on it but i want it to go one more line down and then
append. How can i do this?
Here is my function and some code i am using:
<?
function append_file($filename, $contents)
if ($fp = fopen($filename, "a"))
fwrite ($fp, stripslashes($contents));
fclose($fp);
return 1;
}
else { return 0; }
};
if ($submitButton == "appendfile")
$rs = append_file( "$page", "$test", " ");
echo "<a href=\"$page\">$page</A><BR> ";
?>