PDA

View Full Version : TEXTAREA line breaks?



Zaub
23-09-2008, 08:33 AM
Hey peeps,

I've got an edit profile sort of thing, and I want to make it so when they hit enter and it goes down a line in my textarea box on the form, that will show on the frontend page. So they don't have to use <br>. It shows the text on two different lines when editing in the textarea box eg.

line1
line2

And this is how it shows up on the frontend page:

line1 line2

Would appreciate some help from you fine coders.

Cheers,
Chris.

P.S This is coded in HTML/PHP.

Invent
23-09-2008, 09:07 AM
Use the function nl2br().

So:



echo nl2br( $message );

Zaub
23-09-2008, 09:20 AM
Use the function nl2br().

So:



echo nl2br( $message );


Brilliant!

Thanks.

L?KE
23-09-2008, 02:59 PM
I didn't need this, but it's useful.

Lol for someone who's made user systems can't believe I didn't know that :)

ty.

Want to hide these adverts? Register an account for free!