codice:
$testo=str_replace('  ',' ',trim($_POST[testo]));
$testo=htmlentities(nl2br($testo),ENT_QUOTES);
così gli dai pure una bella pulitina...