Here is the situation:
I have a script which passes the variable for the file name. The next script will pick up that variable and access the server to check for that file name. I then pass the document's contents through a textarea field to be viewed and possibly edited. That works fine, the problem occurs when one of those files contains a /textarea html tag. That tag, regardless of whether there is an open textarea tag in the file as well, will escape my php script by closing the textarea that the file is displayed inside causing all data following that end textarea tag to be lost.
On another note, is there a way to read a file and also have write capabilities? I have tried to fpassthru files by opening them first with everything, but all that seems to work is when I use "r" for read only.
Code snipet below -- greater than and less than symbols will be replaced with ( and ) because im not sure if they will be processed or not.
(TEXTAREA NAME="contents" ROWS="15" COLS="75" WRAP="hard")
(?php
if (!$file = file_exists($name)) {
echo ("File does not exist");
} else {
if (!$file = fopen($name, "r")) {
echo ("Error opening file");
} else {
rewind($file);
fpassthru($file);
}
}
?)
(/TEXTAREA)
Any help on this is greatly appreciated.