Hi, I am trying to validate a form with both JavaScript and PHP. I have wrote the validation scripts, but when I submit the form, the javascript is not creating an Alert box when I test it. The form is as follows: ...... I have the insert.php file and the javascript embedded within the page. The javascript does cause invalid fields to turn yellow, but no Alertbox pops up. Javascript is not blocked any my browsers. This is the entire register.php:
You forgot ";" on the third line here? if (fld.value.length == 0) { fld.style.background = 'Yellow'; error = "The required field has not been filled in.\n"; //semi colon here }