There are two basic ways to handle this. Have the form handling and DB stuff in a block of code on the same page as the form... I usually use something like
if(isset($done))
{
$errors = 0;
$errormsg = "<Font Color=Red>";
if (this != that) {
$errormsg .= "this MUST equal that";
$errors = 1;
}
$errormsg .= "</Font>";
if $errors = 1 {
echo "$errormsg";
} else {
DoDBUpdate();
echo "Thank You!"
exit;
}
}
where $done is the name of the submit button.
Your actual HTML form info should appear just below that code and the page should submit to itself.
The other way to do it is to do your form handling with Javascript using something like
<SCRIPT>
function checkData ()
{
if (document.myForm.threeChar.value.length == 3) {
return true
} else {
alert("Enter exactly three characters. " + document.myForm.threeChar.value + " is not valid.")
return false
}
}
</SCRIPT>
<BODY>
<FORM NAME="myForm" onSubmit="return checkData()" ACTION="dostuff.php">
<B>Enter 3 characters:</B>
<INPUT TYPE="text" NAME="threeChar" SIZE=3>
<P><INPUT TYPE="submit">
</FORM>
</BODY>
Hope that helps