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.
function cleanData($data) {
$data = trim($data);
$data = htmlentities($data);
$data = mysql_real_escape_string($data);
return $data;
}