irkevin Posted October 4, 2008 Share Posted October 4, 2008 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. Quote Link to comment Share on other sites More sharing options...
scvinodkumar Posted October 4, 2008 Share Posted October 4, 2008 read this http://in2.php.net/manual/en/function.strip-tags.php Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted October 4, 2008 Share Posted October 4, 2008 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. Quote Link to comment Share on other sites More sharing options...
irkevin Posted October 4, 2008 Author Share Posted October 4, 2008 i did use nl2br() in a project to hide <br> tags.. but can this be use to hide pther html tags? How do i proceed with this? Thanks for your time Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 4, 2008 Share Posted October 4, 2008 for what you're trying to do you'll need to use a WYSIWYG editor. For such editors look into TinyMCE and/or FCKEditor Quote Link to comment Share on other sites More sharing options...
scvinodkumar Posted October 4, 2008 Share Posted October 4, 2008 read this http://in2.php.net/manual/en/function.strip-tags.php Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 4, 2008 Share Posted October 4, 2008 read this http://in2.php.net/manual/en/function.strip-tags.php 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.