Simple (I hope) updating contents question
| From: | (Er Galv�o Abbott) | Date: | Fri, 20 Jul 2001 02:02:22 +0000 |
| Subject: | Simple (I hope) updating contents question | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-60348@lists.php.net to get a copy of this message | ||
Greetings.
First of all I'm a PHP bginner so take it easy on me :)
I'm trying to make a script that does the following:
* open a text file
* read its contents
* For each line on the file make a input tag with its contents, like
<input type="text" name="line1" value="foo is what we use to ask
questions. It doesn't really mean something.">
* Take the modified contents - modifyied in the input fields - and
update the text file
So, I've begun with:
1 <?php
2 $file = "news.txt";
3 fopen ($file, "r");
4 $fs = filesize ($file);
5 while (!feof($file))
6 {
7 $content = (fgets ($file, $fs));
8 }
9 ?>
One thing I didn't understood is the length part of the fgets
command... Why use length with it? So, what I'm trying to do in lines
4 and 7 is to make sure it gets the contents by setting length = file
size... Am I right on this?
How do I split the contents of the file? Because I'm getting the
content of both lines in the $content variable...
I'm originally a Perl programmer so I know that the "split mark" must
be the end of line, but I'm really lost here.
Can someone help me?
Thanks in advance,
Er Galvão Abbott
Webdeveloper
erabbott@DONTSPAMterra.com.br
---------------------------------
To send me an e-mail just remove
the CAPITAL TEXT.
---------------------------------