write data to a file wich received from GET
Posted: Wed Jun 02, 2010 4:17 pm
I use this script to Write data to a file wich sent from GET method.
But it doen't write datas with sent as 2nd time.
it writes data the file at only 1st time.
what is the bug? i'm having a trouble with it!
But it doen't write datas with sent as 2nd time.
it writes data the file at only 1st time.
Code: Select all
if (isset($_GET['t'])) {
if (!file_exists("list.html"))
{
$myFile = "list.html";
$fh = fopen($myFile, 'w');
$stringData = "\n";
fwrite($fh, $stringData);
fclose($fh);
}
$myFile2 = "list.html";
$fh2 = fopen($myFile2, 'a');
$stringData2 = $_GET['t']."<br> \n <br><p>";
fwrite($fh2, $stringData2);
fclose($fh2);
echo "\n complete";
}