Article

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Article

Post by Mr. Tech »

Hi!

I am making an article manager and need some help. For example this forum. I type my post in the textarea and it automatically puts a

<br />

for every break. How can I do that?

Thanks :wink:

Tech
User avatar
lazy_yogi
Forum Contributor
Posts: 243
Joined: Fri Jan 24, 2003 3:27 am

Post by lazy_yogi »

Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

Thanks!
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

I had a look and I have no idea on what I need to do. Does any one think they could write up a littel something that will do it for me? Thanks!

See in some of the users comments they replace these \n. I tried that and it didn't work.

Thanks for any help! :D
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

All you need to do is run this function on the info from the text area before you want to display it and it will put a HTML line break next to all the new line characters. Just do something like:

Code: Select all

echo nl2br($my_textarea);
Mac
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

Thanks.

This is what I used when processing the form:

$textarea = nl2br($textarea);

:D
Post Reply