Forum Moderators: coopster
from what i have been reading, i need to use:
fopen(filename,mode,include_path,context)
But do i need fclose also?
Do i need to create an original text file?
Will this file be able to be read into the <textarea> or should i just throw it into the <td> file here </td>
just looking for some insight, or a realworld example.
thanks
$display .= '<tr colspan="2" height="5px"><td width="25%" align="center" bgcolor="#DADCBE"><strong>Summary</strong></td>
<td align="center" bgcolor="#DADCBE"><strong>Weekly Notes</strong></td></tr>
<tr><td valign="bottom">Return Visitors: '. $reg_last_visit . '</td>
<td rowspan="2">
<form name="form1" method="post" action="">
<textarea name="textarea" cols="87" rows="10"></textarea>
</form>
</td></tr>
<tr><td valign="bottom">Total Weekly Traffic: '. $tc . '</td></tr>';
<?php
$handle = fopen("/etc/passwd", "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>
<html><body><form>
<textarea>
<?php echo $contents?>
</textarea>
</form></body></html>
The include path and context are optional for the fopen. And one should always close any files one opens.
[edited by: SteveLetwin at 10:27 pm (utc) on Aug. 21, 2007]
1)
$handle = fopen("/etc/passwd", "r");
$contents = fread($handle, filesize("/etc/passwd"));
or 2)
$filename = "/etc/passwd";
$handle = fopen($filename, "r");
of course you should also probably be reading and displaying a different file....