Help - Cleaning Input Data

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
michaeru
Forum Commoner
Posts: 28
Joined: Sun Mar 07, 2010 5:22 pm

Help - Cleaning Input Data

Post by michaeru »

Good day,

I would like to ask the most efficient way to clean (remove HTML tags, and other formatting) the input data.

Something to add to:

stripslashes(strip_tags(htmlentities($_POST['val'])))

-Michaeru
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Help - Cleaning Input Data

Post by flying_circus »

Regular Expressions are probably your best bet.

For most projects I dont strip tags. Use htmlentities() when you display the text and it should render exactly what was typed.
Post Reply