Adding HTML tags to TEXTAREA text?

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
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Adding HTML tags to TEXTAREA text?

Post by mjseaden »

Hi,

I have a TEXTAREA control, in which I enter text. I then store this text in a MySQL element in a table.

However, when I output the text to the screen through echoing it, the carriage returns don't show. I take it this is because HTML needs <BR> tags for a carriage return, and doesn't recognise the carriage returns in the TEXTAREA.

Is there any function to add appropriate HTML tags automatically in PHP so that when stored in the MySQL element, they will show appropriately?

Many thanks

Mark
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

function nl2br() is for you
Post Reply