How can I validate user input in simple way?
<p>I have the below function to validate the user input. Can you suggest whether it is OK or not? I just need simple way of validating user input. no need complex way.</p>

<pre><code>function cleanData($data) {
    $data = trim($data);
    $data = htmlentities($data);
    $data = mysql_real_escape_string($data);
    return $data;
}
</code></pre>
