Hey Bob,
This is hte way I did the validation for a form:
the javascript code:
<SCRIPT LANGUAGE="JavaScript">
function test()
{
if ((document.registration.initials.value=="")
|| (document.registration.name.value=="")
|| (document.registration.city.value=="")
|| (document.registration.gender.value=="")
|| (document.registration.country.value=="")
|| (document.registration.email.value==""))
{
alert('You have to fill in your initials, name, city, country and email address. One or
more of these fields are empty.');
}
else
{
if ((document.registration.room.value="dd") && (document.registration.shareid.value==""))
{
alert('Please fill in the name or user code of the person sharing the room with you.');
}
else
{
document.forms[0].submit();
}
}
}
</script>
And the form declarations:
<form action="registration.php" name="registration" method="POST">
// the form elements
<input type="button" ONCLICK="test()" class="formel_2" value="Submit Form">
<input type="reset" class="formel_2" value="Reset Form"></form>
Of course, the you can acces these variables in the recieving file through:
$variablename = $_POST['variablename'];