if you do the form validation on the client side, you can make sure that the user enters in the correct value BEFORE the value is sent back to the server. that way, your error control is handled w/out having the server to do it....
if not, try this.....
$errormsg = validate_form($HTTP_POST_VARS, $errors);
if (!empty($errormsg)) {
print "ERROR";
} else {
do whatever.....
}
function validate_form(&$frm, &$errors)
{
$errors = new Object;
$msg = "";
if (empty($frm["oldpassword"])) {
$errors->oldpassword = true;
$msg .= "Input is incorrect";
}
return $msg;
}