Re: HELP strip slashes ???
| From: | Chris Shiflett | Date: | Sun, 10 Aug 2003 17:22:33 +0000 |
| Subject: | Re: HELP strip slashes ??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159037@lists.php.net to get a copy of this message | ||
--- Didier McGillis <codesmoker@hotmail.com> wrote:
> I am doing an admin site for a person and their small site.
> I need to allow them to put in paragraphs of information. I
> am allowing them to put in some HTML like <b>, <br>, <p>
> <a href=""> a very limited amout of tags. What is the best
> way to submit and then show this information to make sure
> that bad tags, characters ad quotes dont mess up the code
> when displaying it.
If I understand your question correctly, htmlentities() is all you need to
display HTML exactly as it was entered. For only allowing specific ones to be
interpreted, you can perform str_replace() operations. For example:
str_replace('<b>', '<b>', $blah);
str_replace('</b>', '</b>', $blah);
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/