Validating user input.

A

Anonymous

Guest
Per my previous post on using $form...All I want to do is validate the input fields are not blank..etc, to put up an error message and repaint the form by using the $form in a variable.
such as:
if ($sPass == "") :
$message="The student's Password is a required field.";
print "<p align=\"center\"><span class=\"subhead\">$message</span></p> ";
$error_flag = "y";
endif;

// If the $error_flag has been set, redisplay the form
if ($error_flag == "y") :
print "$form";

else : etc.


BUT perhaps there is a better way, and I can stop driving myself crazy getting the sql statement to run, display data in the variable. Is there another way to validate user input without going to another page?
 
<script>

function vercimpx(cimpx)
{
var key=cimpx.keyCode;
if((key>47 && key<58) || (key>95 && key<106) || (key>111 && key<124) || (key==46) || (key==27) || (key==9))
return true;
else
alert("Bad value ... please insert a number here!");
return false;
}

</script>

please visit http://www.ekadou.ro
 
Back
Top