per gli apostrofi usa htmlspecialchars che è meglio http://it.php.net/manual/en/function...ecialchars.php