Reply to Re: Line breaks

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация