On Jul 10, 2007, at 5:33 PM, David Wonderly wrote:
I am trying to create a small script to open a file and edit it.
However, when I open a file with PHP in it the PHP is stripped out. It
open as if I was viewing the page source. How do I fix this?
Here is the code I am using.
<form action="filewrite.php" method="post">
<textarea rows="15" cols="70" name="content">
<?php
include($file) ;
?>
</textarea>
<input type="text" name="filename" />
<input type="submit" />
</form>
Filewrite looks like this
<?php
$File = $filename;
$Handle = fopen($File, 'r+');
$Data = $content;
fwrite($Handle, $Data);
fclose($Handle);
print "Data Written.";
?>
Like I said, it is very simple but, I can write php if I start with a
blank page but, I can open a file and view it. All of the files are at
david.wonderly.com
Thanks!
-Dave
Look at the line:
$Handle = fopen($File, 'r+');
the 'r+' should be 'w+' if you are trying to create and write to a file.
JK
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php