How to Disable Html codes in chat script

Total Post:24


 1872  View(s)
Rate this:
Hi Expert!

I Have Created A simple Chat script m using mysql fetch array to show the text written by users but a lot of users using html codes in text box and Changing my site configs [like Text color adding Images] please help me how to show the entered Html code as plaintext ?

Thanks in advance.

  1. Re: How to Disable Html codes in chat script

    You can try as following

    You can use htmlentities() for that.

    An example of what it does:

    $str = "A 'quote' is <b>bold</b>";

    // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;
    echo htmlentities($str);

    // Outputs: A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;
    echo htmlentities($str, ENT_QUOTES);

    I hope it helpful for you.


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.