PHP text editing
Posted: Sat Jan 22, 2005 6:47 am
hi, i did a small script to edit a txt file though IE but everytime i edit the txt when i put ' or \ it put another \ before it
any one can correct my code plz?
edit.php
process.php
where is the error??
thanks
any one can correct my code plz?
edit.php
Code: Select all
<?
$filename = "../sport.txt";
$fp = fopen ($filename, "rw");
echo "<form method=post action=process.php>\n";
echo "<textarea rows='6' cols='40' name='content'>\n";
$content = fread ($fp, filesize ($filename));
echo $content;
echo "</textarea><br><br>";
fclose ($fp);
echo "<input type=submit value=Submit>\n";
echo "</form>";
?>Code: Select all
<?
$filename = "../sport.txt";
$fp = fopen ($filename, "w");
// write to file
if (!fwrite($fp, $_POSTї'content'])) {
echo "Unable to modify the file";
exit;
}
echo "Successful!";
fclose($fp);
?>thanks