i use this where it opens the file news.php.
$fd = fopen($filename_news, "r") or die ("cannot read $filename");
$read_file = fread($fd, filesize($filename_news));
echo "<form name='form1' action='save_news.php' method='post'>";
echo '<textarea cols="80" rows="8" name="txt_box_news">'.$read_file.'</textarea>';
echo '<input type="submit" name="submit" value="save">';
echo '</form>';
ONCE i click on the save button i do this !!!
$this_box_save_news = $_POST['txt_box_news'];
$filename_news = "pages/news.php";
$fd= fopen($filename_news, "w+") or die ("cannot open $filename");
$fout = fwrite ($fd, $this_box_save_news);
fclose($fd);
$filename_news = "pages/news.php";
$fd= fopen($filename_news, "w+") or die ("cannot open $filename");
$fout = fwrite ($fd, $this_box_save_news);
fclose($fd);
lets say i input <?php echo 'HELLO WORLD'; ?>
the output wouldnt show as the input shown above is chnaged on save. It actually changes to
<?php echo '/HELLO WORLD/'; ?>
and i get this error
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in d:\program files\apache group\apache\htdocs\tests\test_editor\pages\news.php on line 2
Parse error: parse error, unexpected $end in d:\program files\apache group\apache\htdocs\tests\test_editor\pages\news.php on line 3