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.

 

 

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.

The way I see it the OP wants to keep the tags in but not allow a user to edit them. As they may not know how to edit HTML. This is the job of an WYSIWYG editor as I suggested.

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.