Jump to content

Form with proper spacing...


voyde

Recommended Posts

I'm assuming you meant to post a < br /> tag above.

 

I would suggest NOT converting line breaks to BR tags before saving to the database. Otherwise youwill have to convert again if you need to repopulate a textarea for editing.

 

Instead, when you get the content from the database, use nl2br() when displaying it.

User enters this into a textarea:

Here is
some text
with several
line breaks

 

You would enter that (as is) into the database.

 

Now when you need to display that text in HTML you would use this:

nl2br($textFromDB) which would output this:

Here is<br />some text<br />with several<br />line breaks

 

However if you need to populate the original text back into a textarea for editing you just use the value from the database w/o nl2br().

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.