Re: formatting paragraphs in to strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Nowosielski wrote:

>  I'm having a perplexing problem. I'm gather data through a <textarea>
> html from field and dumping it to MySQL.
> 
>  I want to display the data as a long string with no carriage returns or
> line breaks in a dhtml div window.
> 
> The problem I'm have is that the form data is remembering the carriage
> returns. I tried using trim() and rtrim() with no luck. The data is
> still formatted exactly like it was inputed.

this happens only if the text is dsiplayed as pre-formated, like inside
<pre></pre>-tags, but this can also be done by CSS


> Any ideas why this is happening and how I can format the text properly??

not, with any look at your code or results


try

preg_replace( '|\s*|', ' ', $string );


it will replaces any occurence of one or more white-space-characters
with one single space


http://www.php.net/manual/en/reference.pcre.pattern.syntax.php

-- 
Sebastian Mendel

www.sebastianmendel.de
www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux