title: I can't get this to work, php sanitize filters
body: <p>Can someone tell me what I am doing wrong? I am trying to sanitize and validate a form user input with the php filters.  This input is going to go to a mySql database then an html page output so I need to remove all html tags and also provide security for mySQL.</p>
  
  <p>Thanks.</p>
  
  <pre><code>      /*
   * BEGIN Sanitize and validate
   */
  
    // Adding fields to sanitize array.
  $filters = array(
     'author'  =&gt; FILTER_SANITIZE_SPECIAL_CHARS,
     'title'  =&gt; FILTER_SANITIZE_SPECIAL_CHARS,
     'description'  =&gt; FILTER_SANITIZE_SPECIAL_CHARS,
  );
  
  
  /*** apply the filters to the POST array ***/
  $filtered = filter_input_array(INPUT_POST, $filters);
  
  
   // filtering out anything that isn't an email address
      $sanitized_email = filter_var(($_POST["email"]), FILTER_SANITIZE_EMAIL);
      if ( filter_var($sanitized_email, FILTER_VALIDATE_EMAIL)  == TRUE) {
          echo '';
      } else {
          echo 'Invalid Email Address.  Go Back.';
          exit;
      }
  
      /*
   * BEGIN sanitize and validate
   */
  </code></pre>
  
  <p>New code but still not working.  I am doing something wrong.  Still getting html in database and the errors are not working.</p>
  
  <pre><code>      /*
   * BEGIN Sanitize and validate
   */
  
    // Adding fields to sanitize array.
  $filters = array(
     'author'  =&gt; FILTER_SANITIZE_STRING,
     'title'  =&gt; FILTER_SANITIZE_STRING,
     'description'  =&gt; FILTER_SANITIZE_STRING,
  );
  
  
  /*** apply the filters to the POST array ***/
  $filtered = filter_input_array(INPUT_POST, $filters);
  $filters = array_map('mysql_real_escape_string',$filters);
  $filters = array_map('htmlspecialchars',$filters);
      if ( filter_var_array($filtered, FILTER_SANITIZE_STRING)) {
          echo '';
      } else {
          echo 'Invalid Input.  Go Back.';
          exit;
      }
  
  
  
  // filtering out anything that isn't an email address
      $sanitized_email = filter_var(($_POST['email']), FILTER_SANITIZE_EMAIL);
      if ( filter_var($sanitized_email, FILTER_VALIDATE_EMAIL)) {
          echo '';
      } else {
          echo 'Invalid Email Address.  Go Back.';
          exit;
      }
  
      /*
   * BEGIN sanitize and validate
   */
  </code></pre>
  
  <p>2nd Edited below:</p>
  
  <p>Got sanitized data to show in database by adding the sanitizing code to the area of the script that takes the data to the database.</p>
  
  <pre><code> $_POST['author'] = mysql_real_escape_string(trim($_POST['author']));
        $author=filter_var($_POST['author'], FILTER_SANITIZE_STRING);
  
        $_POST['email'] = mysql_real_escape_string(trim($_POST['email']));
        $email=filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
  </code></pre>
  
  <p>Now I have to finish trying to validate the email.</p>