|
Posted by David Haynes on 02/25/06 22:19
Krustov wrote:
> This is what I have to remove the line breaks when a user enters one or
> more blank lines in a form entry - so everything is (or should be) on
> the one line .
>
> $skunk=str_replace("\n"," ",$skunk); $skunk=trim($skunk);
>
> The following is what appears in the flatfile afterwards .
>
> line breaks
>
> why does
> it
> do this
>
> While it displays correctly on the webpage when grabbed from the
> flatfile - curious why it does this and how it can be fixed to appear as
> one line of text in the flatfile .
If the lines were created on a Windows platform, chances are that they
end with '\r\n' not just \'n'.
So you need to:
str_replace("\r", '', str_replace("\n", '', trim($skunk)));
-david-
[Back to original message]
|