Jump to content

Converting textarea text into pure html?


SC__Programmer

Recommended Posts

How?

 

Im trying to make a homepage welcome thingy,in the admin panel you have a textarea box where you edit the text.when i load the value of the database(Test<br><br>Test) it shows up in the textarea as Test<br><br>Test,i want it to show up as

Test

Test

and when the user gets done editing its going to be like this

Edited

Edited

and when they push save i want it to convert to Edited<br><br>Edited so i can save it to the database.

Link to comment
Share on other sites

  • 2 weeks later...

Save the data as-is to the database. Before printing it to the screen, run the text through the php nl2br() function. When you are putting the data into a textarea, you won't have to do anything, as you save it in its original form in the database, so putting it back in a textarea will make it exactly the same as it was before it was saved.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.