ho fatto così, ma si potrebbe fare di meglio, no?
Codice PHP:
<?php
$to = "lelebart@hotmail.it";
if (!isset($_POST['submit'])) {
showForm();
} else {
$error = 0;
if(empty($_POST['casso'])) {
$error = 1;
$errstr[] = "Prego scelga un'opzione 1";
}
if($_POST['casso']==val) {
$error = 0;
}
...
if ($error == 1) {
echo "<center>\n<font style=\"color: #FF0000\">\n";
foreach($errstr as $err) {
echo "[*] " . $err . "\n";
}
echo "</font>\n</center>\n
";
showForm();
} else {
@mail(...);
echo "blabla
";
}
}
function showForm()
{
$_POST['message'] = @htmlspecialchars(@$_POST['message']);
echo <<<EOD
<form method="POST">
<input type="radio" name="casso" value="si">Si
<input type="radio" name="casso" value="no">No
<input type="radio" name="casso" value="val" disabled="true" checked>
...
<input value="Procedi" type="submit" name="submit" />
</form>
EOD;
}
?>