I am currently collecting form values from a textarea and then storing this along with normal textfield values in a flat text file using PHP. The problem is that when I read the file back in, I want each line of the file to be a separate array entry, so that when I use $data = file ("messages/$filename"); to get the info back, each $data[$n] is a separate value. However, because people are entering carriage returns when putting text in the textarea field, I get \n values returned into my text file, which shifts all the text down by one line and causes problems with the array.
How can I filter out the "\n" and replace it with nothing or ""???
I've tried using:
$pattern = "\\n";
$replace = "";
$value = eregi_replace ($pattern, $replace, $value);
and
$pattern = "\\n";
$replace = "<br>";
$value = eregi_replace ($pattern, $replace, $value);
But neither seems to work. ANy help appreciated.