Thanks for your help but it didn't work.
I added this wrap=virtual thing to the textarea tag, and replaced ereg_replace with str_replace.
html:
<textarea name="foo" cols="40" rows="3" wrap="virtual"></textarea>
php:
$foo=str_replace ("\n", '', $foo);
$foo=str_replace ("\r", '', $foo);
$foo=str_replace ("<br>", '', $foo);
$foo=str_replace ("<p>", '', $foo);
$foo=str_replace ("%0D%OA", '',$foo);
$foo=str_replace ("0A", ' ', $foo);
$foo=str_replace (chr(13),' ',$foo);
$foo=str_replace (chr(10),' ',$foo);
(none of these work)
$fp = fopen ("lomakkeet/textfile.txt", "a")
fwrite ($fp, $foo);
fclose ($fp);
Still, when i open this text file in mickeysoft's excel, the data appears in several lines, if enter was pressed in textarea field 🙁