hello all,
I have a text box that I take user comments into. That then saves in a text file on the server. I then have another file read those in to fill out a form. my problem is that on the comments box since it's a text box the info comes out as
testing this file
I want it to show up on one line to be read I tried delimiting it with *'s but it still only reads one line at a time so I lose the "this file" and only get "testing"
TIA
would nl2br work?
e.g
$newtext=nl2br($text); // Enter $newtext into text file
If the user entered:
This Is A File
Then it would leave you with a file saying:
This<br>Is<br>A<br>File
Sounds like you're just reading the text file wrong. What are you doing?
$file = file("filename.txt");
for ($i=0; $i<=count($file); $i++) { $fields = split("*",$file[$i]); }
the contents of the file is
usernamethis is a testipaddress username2this is a test2ipaddress2
If you want to just read the whole file into one big blurb, use [man]filegetcontents[/man] instead of file.
But it looks like you'll want to store multiple users on multiple lines. So, you may want to replace \r and \n with spaces before inserting it into the text file.