To validate or sanitise your input, use PHP's filter functions:
Validation is used to validate or check if the data meets certain
  qualifications. For example, passing in FILTER_VALIDATE_EMAIL will
  determine if the data is a valid email address, but will not change
  the data itself.
Sanitization will sanitize the data, so it may alter it by removing
  undesired characters. For example, passing in FILTER_SANITIZE_EMAIL
  will remove characters that are inappropriate for an email address to
  contain. That said, it does not validate the data.
If you want to display the data, you need to escape the HTML entities. You can do this with the htmlentities function.
Are you going to store the data in a database? Depending on the way you connect to your database (MySQL functions, MySQLi or PDO) you need to use (respectively) mysql_real_escape_string, mysqli::real_escape_string or mysqli_real_escape_string, or PDO::quote or prepared statements.
Do you want to use the values in a URL? Then you need to use the urlencode function.