hi…
i’m trying to sort out this text area that adds text to a textfile called test.txt…im just using the one text box so i want it so when you hit enter to start a new line in the text box it inserts a linebreak when you’ve submitted the text into the textfile…
i also want each post to just wipe over the last…so theres only ever one lot of text in the text file at a time… thanks
heres the code im using for the php file to add text:
<?php
$filename = 'test.txt';
$somecontent = '<table width="90" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="6" align="right" valign="middle"></td>
<td width="84" align="left" valign="top"><strong>' . date('d.m.y') . '</strong></td>
</tr>
<tr>
<td align="right" valign="top">-</td>
<td align="left" valign="top">' . nl2br($_POST['updates']) . '</td>
</tr>
</table>';
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, Updates were changed!";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>
and if you want to see the text box…its here :
http://www.band-central.net/atreyu/test/index.php
and the post gets added to this page
http://www.band-central.net/atreyu/home.php
on the left side in the ‘updates’ box