Laserlight,
Thanks for the reply and help. I am using > 4.3
I continue to get error messages on (3) lines up from end container, the else {
But can't seem to figure why, tried double and single closing brackets above and below this.
Using fullfilename (which works), I'm putting this in a textarea as follows:
<textarea name="textarea" cols="80" rows="15" wrap="VIRTUAL">
<?php
$filename = $row_Recordset_ss['rID'].'__rrr.txt';
$fullfilename=$_SERVER['DOCUMENT_ROOT']."/folder/".$filename;
//check if file exists
if (file_exists($fullfilename)) {
//user submitted the form properly?
if (isset($_POST['submit']) && isset($_POST['contents'])) {
//can we write to the file?
if (is_writable($fullfilename)) {
//open a file pointer to the file
if ($fp = fopen($filename, 'wb')) {
//write to the file
$bytes = fwrite($fp, $_POST['contents']);
if ($bytes === false) {
echo "Error: could not write to file '{$fullfilename}'";
}
else {
echo "{$bytes} bytes written to file '{$fullfilename}'";
}
fclose($fp); //now we close the file pointer
}
else {
echo "Error: could not open file '{$fullfilename}' for
writing";
}
}
else {
echo "Error: file '{$fullfilename}' is not available for writing";
}
}
else {
//can we read from the file?
if (is_readable($fullfilename)) {
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'
. '<textarea name="contents" rows="20" cols="60">'
//assumes PHP 4.3.0 or newer PHP version
. htmlspecialchars(file_get_contents($fullfilename))
. '</textarea><br />'
. '<input type="submit" name="submit" value="Edit"></form>';
}
else {
echo "Error: could not open file '{$fullfilename}' for reading";
}
}
//parse error here
else {
echo "Error: file '{$fullfilename}' does not exist";
}
?>
Please note - below this I'm using:
<form method="POST" name="form1" >
<input type="submit" name="MM_update" value="Update R">
(wondering how this integrates with your bulleted list above)
Thankful for any help
p.s. I tried to look up "content" in php.net searchbox before this post, no results returned.