Re: [PHP] formatting paragraphs in to strings

2005-06-13 Thread Philip Hallstrom
Good point. Only problem is, if someone hit enter a-million times, you would end up with a-million spaces where the "\n" characters were. To take care of that repetition, maybe something like: while (strpos($textarea_text, "\n\n")) { . } would be one way you could do it. $new_str =

Re: [PHP] formatting paragraphs in to strings

2005-06-13 Thread Richard Lynch
On Mon, June 13, 2005 12:06 pm, Paul Nowosielski said: > I'm having a perplexing problem. I'm gather data through a > 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. What styles have you ap

Re: [PHP] formatting paragraphs in to strings

2005-06-13 Thread John Browne
Right.. But the browser also should be ignoring the carriage returns as well, which makes me think the div is set to "white-space: pre;" or something. He said the text is being formatted in a div exactly how it is entered into the system. By default, a div does not render any carriage returns.

RE: [PHP] formatting paragraphs in to strings

2005-06-13 Thread Murray @ PlanetThoughtful
> Good point. Only problem is, if someone hit enter a-million times, > you would end up with a-million spaces where the "\n" characters were. > To take care of that repetition, maybe something like: > > > while (strpos($textarea_text, "\n\n")) { > . > } > > > would be one way you cou

Re: [PHP] formatting paragraphs in to strings

2005-06-13 Thread John Browne
Good point. Only problem is, if someone hit enter a-million times, you would end up with a-million spaces where the "\n" characters were. To take care of that repetition, maybe something like: while (strpos($textarea_text, "\n\n")) { . } would be one way you could do it. On 6/13/05

RE: [PHP] formatting paragraphs in to strings

2005-06-13 Thread Murray @ PlanetThoughtful
> Use the PHP str_replace function before writing it to the DB. Replace > all "\n" characters with an empty string "". > > http://us2.php.net/manual/en/function.str-replace.php I think it might be better to replace all "\n" characters with spaces " ", otherwise you will end up with sentences tha

Re: [PHP] formatting paragraphs in to strings

2005-06-13 Thread John Browne
Use the PHP str_replace function before writing it to the DB. Replace all "\n" characters with an empty string "". http://us2.php.net/manual/en/function.str-replace.php On 6/13/05, Paul Nowosielski <[EMAIL PROTECTED]> wrote: > Hi, > > I'm having a perplexing problem. I'm gather data through a