basta usare sul testo proveniente dal campo, la funzione htmlentities