Jump to content

hiding html tags in Textarea when data coming from mysql Database


irkevin

Recommended Posts

Hi,

 

I'm running in some sort of problem.

 

I have a database which have some html tags like <br />, <p> and so on.

 

The problem is, when i output the data in a html textarea, the html code is being shown up too. Obviously, if a client want to update something and doesn't have a clue of what HTML is, he will go crazy

 

So what is the best way to hide html tags into a textarea?

 

Help me plz.

 

 

Link to comment
Share on other sites

There are sooo many answers to this question... if you want things like font styles, etc to stay, you'll have to look into implementing some kind of a flash or javascript text styler, or you'll need to implement some kind of bbcode. If you simply want to strip the tags and then change new line characters to line breaks for the input, there's a simple answer: nl2br() and strip_tags()... but I doubt that's what you want to do. If you don't want your client to see html tags you need to figure out how to remove the tags from the database without compromising style, or figure out how to make formatting more user friendly so your client can handle using it.

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.