I understand there are numerous similar questions; however, none correctly fully answer my question.
I'm allowing the user to add formatted HTML to a textfield (strong, ul, li). I will then need to safely display, avoiding any XSS etc.
Side note: Using prepared statements.
Should I encode my HTML from the form using htmlentities() (or htmlspecialchars) and input that into the database. I also don't believe using html_entity_decode($html); would protect me from an XSS attack?
I could run the strip_tags(); prior to inputting in MySQL. I'm not sure this is the best?
If I allow the user to input HTML into MySQL and use htmlentities() to display, I want to render the HTML now display it.