Re: text file reading and overwrite
| From: | Patrick Teague | Date: | Tue, 25 Feb 2003 02:21:29 +0000 |
| Subject: | Re: text file reading and overwrite | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137021@lists.php.net to get a copy of this message | ||
> Have a problem in reading a text file and displaying it in a text box
> area,also what function should i used to overwrite an existing text file.
For <textarea> type text boxes, use the following -
<textarea>$var</textarea>
Please note that if you include *any* kind of spaces or tabs or other
characters between the textarea tags that it will dump them into the text
area as well. i.e. -
<textarea>
$var
</textarea>
The 'action' file of the form will receive the following (unless the
contents are modified of course) - "\n $var\n "
For <input> type text boxes, use the following -
<input type='text' value='$var' />
As to reading a file, see Example 1 under fgets(). For deleting files, see
unlink().
Patrick
p.s. you'll want to html encode $var before dumping it into either one of
these or else the contents of $var could mess up the html in the page.