[thelist] converting \n\n to \n on form submission

Dunstan Orchard dunstan at 1976design.com
Mon Oct 7 16:51:02 CDT 2002


Hi there,

anyone know how I take a form submission and replace occurances of double new
lines with a single new line.

so replace this:

"hello.\n
\n
how.\n
\n
dee-doo."


with:

"hello.\n
how.\n
dee-doo."

doing this doesn't seem to work:

$comment = ereg_replace("\n\n","\n",$comment);


thanks - dunstan

p.s. When the form is displayed I'm using nl2br() to format it correctly.
p.p.s. I hope the code doesn't render in your email reader!

---------------------------
Dorset, England
http://www.1976design.com/
http://www.orchard.it/
http://www.maccaws.org/



More information about the thelist mailing list