Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Replacing \n with <br>

0 views
Skip to first unread message

Oleg V. Poliannikov

unread,
Jan 23, 2002, 2:52:10 PM1/23/02
to
I'm sure this is a well-known problem, and a lot of people have
ready-to-use solutions, but I couldn't find them online.

I'm trying to have users to submit their personal information through
a webform. One field there is "Address", for which I use TEXTAREA. The
input is then sucked into PHP, which treats it as a string with
occasional \n or \n\r characters. To display the address on the
webpage I need to replace those characters with "<br>".

What's the simplest way to do it?

P.S. I could use <pre> tag, but I don't like the fact that it gets the
text displayed in the fixed-width font.

Thank you.

Oleg*

Andreas Hjordt

unread,
Jan 23, 2002, 11:35:14 PM1/23/02
to
"Oleg V. Poliannikov" <ovpo...@eos.ncsu.edu> wrote in message
news:937e7414.02012...@posting.google.com...

> I'm sure this is a well-known problem, and a lot of people have
> ready-to-use solutions, but I couldn't find them online.
>
> I'm trying to have users to submit their personal information through
> a webform. One field there is "Address", for which I use TEXTAREA. The
> input is then sucked into PHP, which treats it as a string with
> occasional \n or \n\r characters. To display the address on the
> webpage I need to replace those characters with "<br>".
>
> What's the simplest way to do it?

nl2br()
AFAIR otherwise search php.net.

regards,
Andreas Hjordt

0 new messages