Originariamente inviato da Shores
Beh, devi scrivere un codice che controlli i vari elementi dell'array $_POST facendo gli stessi controlli che facevi prima, per intenderci:

Codice PHP:
$tuttook=true;
if (!isset(
$_POST["primocampo"]):
    
$tuttook=false;
else:
    if (
$_POST["primocampo"]==""):
        
$tuttook=false;
    endif;
endif; 
... qui ripeti quanto sopra per ogni campo modificandolo a dovere e poi...

Codice PHP:
if ($tuttook):
    
//qui fai quel che c'è da fare quando la form è a posto
else:
    
//qui stampi gli errori, insommadici che non è andata
endif; 
Ciao!
ho modificato così, dimmi se va bene:


<?
$tuttook=true;
if (!isset($_POST["nome"]):
$tuttook=false;
else:
if ($_POST["nome"]==""):
$tuttook=false;
endif;
endif;

}
var re = new RegExp("^[!#$&'*+/-9=?A-Z^-~-]+(\\.[!#$&'*+/-9=?A-Z^-~-]+)*@[!#$&'*+/-9=?A-Z^-~-]+(\\.[!#$&'*+/-9=?A-Z^-~-]+)+$","");
if (f.email.value != "" && !f.email.value.match(re)){
alert("Inserire un indirizzo E-Mail valido.")
f.email.focus();
f.email.select();
return false;
}
$tuttook=true;
if (!isset($_POST["url"]):
$tuttook=false;
else:
if ($_POST["url"]==""):
$tuttook=false;
endif;
endif;

}
$tuttook=true;
if (!isset($_POST["città"]):
$tuttook=false;
else:
if ($_POST["città"]==""):
$tuttook=false;
endif;
endif;

}
$tuttook=true;
if (!isset($_POST["messaggio"]):
$tuttook=false;
else:
if ($_POST["messaggio"]==""):
$tuttook=false;
endif;
endif;

}
?>

Il form è così:

<form method="POST" action="ins.php" name="mioform" onSubmit="return controlla()">
<tr>
<td><font size="2">NOME:</font><font size="2" color="red"> *</font></td>
<td><input name="nome" size="30" maxlength="25" style="border:1px solid"></td>
</tr>
<tr>
<td><font size="2">EMAIL:
<font color="#008080"></font></td>
<td><input name="email" type="text" onBlur="this.value=ignoreSpaces(this.value);" style="border:1px solid" size="30" maxlength="40"></td>
</tr>
<tr>
<td><font size="2">SITO:
<font color="#008080"></font></td>
<td><input name="url" type="text" value="http://" onBlur="this.value=ignoreSpaces(this.value);" style="border:1px solid" size="30" maxlength="50"></td>
</tr>
<tr>
<td><font size="2">CITTA':
<font color="#008080"></font></td>
<td><input name="città" type="text" style="border:1px solid" size="30" maxlength="50"></td>
</tr>
<tr>
<td valign="top"><font size="2">MESSAGGIO:</font><font size="2" color="red"> *</font></td>
<td><textarea name="messaggio" cols="40" rows="10" style="border:1px solid"></textarea>
</td>
</tr>


<td width="250" align="center"><input type="submit" value="Invia!"></a>
</td
</tr>
</form>