Jump to content

removing HTML code


webguync

Recommended Posts

Or

 

$string = htmlentities("<span style=\"font-size:10px; font-weight:bold;\">Hello <em>World</em></span>");
echo $string;

 

 

That will produce:
<span style="font-size:10px; font-weight:bold;">Hello <em>World</em></span>

which is not what the OP wants.

Link to comment
Share on other sites

He never said anything about stripping tags. He said "remove html". Which is what htmlentities( ) will do.

 

<span style="font-size:10px; font-weight:bold;">Hello <em>World</em></span>

 

is not html.

I think you'll find it is HTML but in its raw form. I think everyone else will agree with me that you're not actually removing anything at all. The OP should clarify.
Link to comment
Share on other sites

I think you'll find it is HTML but in its raw form. I think everyone else will agree with me that you're not actually removing anything at all. The OP should clarify.

 

It's not HTML? How is it HTML in it's raw form? It's been turned into something that will be printed on screen instead of interpreted as HTML?

Link to comment
Share on other sites

I think the point of the OPs post is to not allow people to post HTML tags to his/her script. I think we're deviating from the subject a bit. The facts of the matter are that the OP did not ask for the HTML to be shown in entity form,. but he DID ask for the HTML to be removed, which I think I have provided the code for.

Link to comment
Share on other sites

I think the point of the OPs post is to not allow people to post HTML tags to his/her script. I think we're deviating from the subject a bit. The facts of the matter are that the OP did not ask for the HTML to be shown in entity form,. but he DID ask for the HTML to be removed, which I think I have provided the code for.

 

With htmlentities, they're not posting HTML tags. htmlentities( ) removes HTML.

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.