Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value equals FALSE. empty() does not generate a warning if the variable does not exist.
Da manuale PHP
Prima proprio non ho visto :
Non penso proprio sia corretto settare $error dopo if aprire parentesi ecc eccCodice PHP:if (empty ($messaggio))
$error = true;
{
echo "Spiacenti, Messaggio vuoto!
";
$error = true;
}
Altrimenti prova cosi (Ovviamente in tutti i controlli)Codice PHP:if (empty ($messaggio))
{
echo "Spiacenti, Messaggio vuoto!
";
$error = true;
}
Codice PHP:if (TRIM($messaggio) == "")
{
echo "Spiacenti, Messaggio vuoto!
";
$error = true;
}

Rispondi quotando