Originariamente inviato da freenetw
Non è più comoda qualcosa di questo tipo?
Codice PHP:
if (empty($_POST['nome']) || empty($_POST['cognome']) || empty($_POST['email']) {
    echo 
"Compilare tutti i campi";
} else {
    
//Qui elabori i dati

Hai ragione! Ho un problema però, visto che uso questo codice
Codice PHP:
// L'INDIRIZZO DEL DESTINATARIO DELLA E-MAIL
$to "info@email.com";

$from stripslashes($_REQUEST['fromname'])."<".stripslashes($_REQUEST['fromemail']).">";

// PER INVIARE E-MAIL IN FORMATO HTML, SI DEVE IMPOSTARE L'INTESTAZIONE CONTENT-TYPE
$intestazioni  "MIME-Version: 1.0\r\n";
$intestazioni .= "Content-type: text/html; charset=UTF-8\r\n";

// L'OGGETTO DELLA E-MAIL
$subject "oggetto;

// COSTRUZIONE DEL CORPO DEL MESSAGGIO
$body = "Nome" . trim(stripslashes($_POST["nome"])) . "\n";
$body .= "Cognome" . trim(stripslashes($_POST["cognome"])) . "\n";
$body .= "E-mail" . trim(stripslashes($_POST["email"])) . "\n\n";
$body .= "Note" . trim(stripslashes($_POST["note"])) . "\n";

// INTESTAZIONI SUPPLEMENTARI
$headers = "From" . stripslashes($_REQUEST['nome']) ." ". stripslashes($_REQUEST['cognome'])."<".stripslashes($_REQUEST['email']).">";

// INVIO DELLA E-MAIL
if(mail(
$to$subject$body$headers$intestazioni)) { // SE L'INVIO E' ANDATO A BUON FINE...

echo "
<div style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;\">Il modulo e' stata inviato con successo.</div>";

} else {
// ALTRIMENTI...

echo "<div style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;\">Si sono verificati dei problemi nell'invio del modulo.</div>.";

}

?> 
mi va in pagina bianca perché c'è già in fondo un IF. Come dovrei impostare la cosa?

Grazie!