title: Escaping PHP GET and POST values
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4223980/the-ultimate-clean-secure-function">The ultimate clean/secure function</a>  </p>
  </blockquote>
  
  
  
  <p>I was informed in another thread that this bit of code was pretty useless:</p>
  
  <pre><code>function getPost($s) {
          if (array_key_exists($s, $_POST))
              return mysql_real_escape_string(htmlspecialchars($_POST[$s]));
          else return false;
      }
  
  
      function getGet($s) {
          if (array_key_exists($s, $_GET))
              return mysql_real_escape_string(htmlspecialchars($_GET[$s]));
          else return false;
      }
  </code></pre>
  
  <p>Can anybody help understand why and how I can make it better please? Links or references are welcome also.</p>
  
  <p>Just trying to always improve :)</p>