What you need to do is validate using regular expressions, then rewite the form input alerting the user, eh? Try this approach:
// set an error flag to 0...
$err = 0;
// falsify on ereg match
if (!$Last_Name) {
$ln=0;
$err=1;
} elseif ((!ereg("[-a-zA-Z,. ]+$", $Last_Name)) || ((strlen($Last_Name) > 26))) {
$ln=0;
$err=1;
} else {
$ln=1;
}
if ($ln == 0) {?>
Either the last name box was left blank or your entry <? print ("$Last_Name "); ?>
contains characters that cannot be accepted. Only up to 26 letters, commas, periods or hyphens are allowed.
<br>
<img src="../images/err.gif" width="18" height="18" align="bottom">
<?
print ("\n <input type=\"text\" size=\"26\" name=\"Last_Name\" value=\"$Last_Name\">");
}
?>
--ph