htmlentities bu işi görüyor olması lazımdı.
$input_gelen = htmlentities($input_gelen); gibi kullanabilirsin.