I am designing an basic ecommerce application, where I have a form to add product.
There are 2 text fields: product name, and description.
product name is input type="text", description is textarea
As user can input anything (worst case scenario), I want to remove all tags (no matter its PHP, HTML, JS, CSS, anything), so that I get just plain text (w/o any tags)
How can I achieve this?
Basically, I need to sanitize string, so any to make it plain text
If you just want to rip out all tags from the user input, then you can use the
strip_tags()function.A better option would be to run the user input through HTML Purifier. It’s a more complete clean.