Use filters to used to validate and sanitize data coming from insecure sources (such as user input).

http://www.w3schools.com/php/php_ref_filter.asp