prova a vedere htmlspecialchars o htmlentities su php.net