Re: Writing & Displaying Records
| From: | Andrew V. Romero | Date: | Thu, 05 Oct 2000 15:23:35 +0000 |
| Subject: | Re: Writing & Displaying Records | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18737@lists.php.net to get a copy of this message | ||
No, right now the records are just being written one right after another. I am
not quite sure how I would sparate the records by carriage returns. Would you
mind elaborating some? This is my first attempt at doing anything with reading
and writing files in php so I still have a lot to learn. I will look into
that command, nl2br too.
Thanks
To reply personally, remove all numbers from my address.
David Robley wrote:
> On Thu, 05 Oct 2000, Andrew V. Romero wrote:
> > I have been trying to make a php file that will write the contents of an
> > html form to a file and this just display that data. Let me give an
> > example, I have a html form with just one text entry called data. The
> > user is going to enter a word into this form and then once they hit
> > submit I want the php file to write what they entered and display what
> > other people have entered. To do this I tried:
> > $wd=fopen("writedata.txt","a");
> > $wdata=fwrite($wd,$data);
> > fclose($wd);
> > $wd=fopen("writedata.txt","r");
> > $currentdata=fgets($wd,50);
> > echo "<br>Data Currently in File: $currentdata";
> > but that jams all the data entered by the various users together and I
> > can't figure out how to seperate it out when I am trying to display it.
> > I don't know if I am writing the file wrong and it is getting crammed
> > together or if it is the way that I am reading the file. If you know of
> > any tutorials that can help me, or if you would be willing to give me a
> > hand I would really appreciate it.
> > Thanks
>
> Presumably the records in your text file are separated by carriage returns?
> Remember that browsers treat carriage returns, spaces and tabs as 'white
> space' and essentially discard them. You need to use nl2br to convert your
> newlines (carriage returns) to BR tags.
>
> --
> David Robley | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES | øý�V{œ
> ïÒC¾Ž]škÄhttp://www.nisu.flinders.edu.au/
> AusEinet |
> http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Andrew V. Romero
Romer1999o@pharmacy.arizona.edu
Remove the #'s from my address to reply.
http://www.u.arizona.edu/~avr/
ICQ #54080914