I have a popup window that opens when I want a person to fill in a textbox. The textbox is then transferred to a .txt file on the server. My problem is that once the popup window is opened, the text on the .txt file is overwritten as a blank file until the user adds their own text.
I would like to figure out what I'm doing wrong or try to find a way to correct this issue.
This is my php:
<?php
date_default_timezone_set('DST');
// Open the text file and prepare to write (will be blank if no text is entered.)
$f = fopen("blog.txt", "w");
// Write text
fwrite($f, $_POST["textblock"] . " -- " . date("l jS \of F Y", time()) . " ");
// Close the text file
fclose($f);
?>
How do I prevent it from blanking out when I open the blog.txt file? I'd like to keep the text that was on there before a rewrite.