non conosco nessun script ma ho fatto questo (molto semplice) per darti una dritta.
I due primi campi non devono essere nulli ed il terzo deve essere settato a si .
File : test2191.php
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!--
.error {background-color:yellow}
-->
</style>
</head>
<body>
<?
function datiOk() {
GLOBAL $errorArray;
$ok = true;
if ($_POST['campo1'] == "") {
$errorArray['campo1'] = "error";
$ok = false;
}
if ($_POST['campo2'] == "") {
$errorArray['campo2'] = "error";
$ok = false;
}
if ($_POST['campo3'] != "si") {
$errorArray['campo3'] = "error";
$ok = false;
}
return $ok;
} // function controlla()
function getValue($postVar) {
if (isset($_POST[$postVar])) {
return $_POST[$postVar];
}
return "";
}
//--------- Array di campi errati
$errorArray = array();
$errorArray['campo1'] = "";
$errorArray['campo2'] = "";
$errorArray['campo3'] = "";
//
if (isset($_POST['submit'])) {
if ($_POST['submit'] == "Invia") {
if (datiOk()) {
//------------- script per aggiornare i dati
exit;
}
}
}
?>
<form action="test2191.php" method="post">
Campo1
<input type="text" name="campo1" class="<? print $errorArray['campo1']=="error" ? "error" : "" ?>"
value="<? print getValue('campo1') ?>">
Campo2
<input type="text" name="campo2" class="<? print $errorArray['campo2']=="error" ? "error" : "" ?>"
value="<? print getValue('campo2') ?>">
Campo3
<input type="text" name="campo3" class="<? print $errorArray['campo3']=="error" ? "error" : "" ?>"
value="<? print getValue('campo3') ?>">devi rispondere si o no
<input type="submit" value="Invia" name="submit">
</body>
</html>