Hope someone can help.

I have a form with several fields in it. One of the fields is a textarea. The user can enter data in this field, including carriage returns etc.,

Once the user clicks on SUBMIT I write the form contents to a text file.

When I read the file, I use FGETS. However the textarea field is now split up into multiple strings, which really messes up the presentation.

How do I keep the contents of the textarea as one BIG LONG string? So I understand I would need to use NL2BR to convert the blank lines with BR, I also have a short piece of code to remove any extra lines and also use TRIM to remove stuff from the end of each line.

But how to join it together and write it as one long string so that it can be read correctly?

Many thanks for any help!



<?php //test.php
	print $file_contents;
<form method="post" action="test.php">
Enter something: <textarea cols=40 rows=10 name="area"></textarea><br />
<input type="submit" name="submit" value="submit">

file_get_contents reads the entire file into a string.