Code:
<?php
if(!defined('USR'))
return;
if($_REQUEST['pf1'] != ""){
$hdl = fopen(HOMEDIR."$usr/".$_REQUEST['pf1'],'w');
fwrite($hdl, $_REQUEST['pft']);
fclose($hdl);
echo "WROTE FILE";
}
$data = "HELLO WORLD";
function gtdr(){
$dir = HOMEDIR.USR;
$dh = opendir($dir);
echo "<html><head><title>HTML EDIT</title></head><body>
<form action='desktop.php?a=$eyeapp' method='post'>NAME:<input type='text' name='pf1'>";
echo "<select name='optsel'>";
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
echo "<option value='$filename'>$filename";
}
echo "</select>";
echo "<br>
<input type='submit' name='pfs' value='Save'><input type='submit' name='pfo' value='Open'>
<input type='reset'><br>
<textarea rows='30' cols='86' name='pft'>";
echo $data;
echo "</textarea>
</body></html>";
return "";
}
gtdr();
?>
$data = "INSERT CODE HERE";
echo $data;
That works, but if I define it outside of the function, it won't show up. When I load information from a file into $data, nothing will show in the <textarea> but I can get it to show up in the Window.
Sorry not making too much sense:
I want to load a file into <textarea> using echo $variable that has read data to it, but it won't load the data into <textarea> via echo $variable;
Make sense now? Sorry I know this is kinda hard.