PHP: I have a very simple PHP file which writes to a txt file. I load the txt in flash. the problem is when the PHP writes to the txt file (color=’#000000’) turns into (color=’#000000’). The number of “” multiplies with each entry. I am sure the problem has a simple answer but i’m very new to php, this is my first day. can anyone help me out?
<?php
$date = $_POST[‘date’];
$news = $_POST[‘news’];
$php = $_POST[‘php’];
$doit = $_POST[‘doit’];
if(!$date) // If email address is not entered show error message
{
echo “Oooops.”;
exit;
}
else
{
$filename = “php.txt”; // File which holds all data
$content = “$doit <br><font color=’#000000’>$date</font><br>$news<br><br>$php<br>”; // Content to write in the data file
$fp = fopen(“php.txt”, “w”); // Open the data file, file points at the end of file
$fw = fwrite( $fp, $content); // Write the content on the file
fclose( $fp ); // Close the file after writing
if(!$fw) echo "Couldn't write the entry.";
else echo "Successfully wrote to the file.";
}
?>
resulting text file:
php= <br><font color=’#000000’>03.05.04</font><br>holy cow<br><br> <br><font color=’#000000’>03.05.04</font><br>why?<br><br> <br><font color=\’#000000\’>03.05.04</font><br>why is this happening?<br><br> <br><font color=\’#000000\’>03.05.04</font><br>kansas city<br><br> <br><font color=\’#000000\’>03.05.04</font><br>cell phones<br><br><br><font color=\’#000000\’>03.05.04</font><br>police cars are fast<br><br> <font color=\’#000000\’><font color=\’#000000\’>03.05.04</font></font><br> go go gadget <font color=\’#000000\’>03.05.04</font> entry four
<font color=\’#000000\’>03.05.04</font>
entry three
<br>