Originariamente inviato da Shores
Per evitare spazi bianchi iniziali e finali puoi scrivere:
$_POST["nome"] = trim(strip_tags($_POST["nome"]));
$_POST["email"] = trim(strip_tags($_POST["email"]));
$_POST["url"] = trim(strip_tags($_POST["url"]));
$_POST["citta"] = trim(strip_tags($_POST["citta"]));
$_POST["messaggio"] = trim(strip_tags($_POST["messaggio"]));
Mentre per controllare ogni valore:
$errore=false;
Poi ripeti questa parte per ogni campo:
if (isset($_POST["nome"])):
if ($_POST["nome"]==""):
$errore=true;
endif;
else:
$errore=true;
endif;
poi se $errore è false è tutto ok, altrimenti c'è stato un errore.
Ciao!