< script > var check = function () { if ( document . getElementById ( 'password' ). value == document . getElementById ( 'confirm_password' ). value ) { document . getElementById ( 'message' ). innerHTML = '' ; document . getElementById ( 'submit' ). disabled = false ; } else { document . getElementById ( 'message' ). style . color = 'red' ; document . getElementById ( 'message' ). innerHTML = 'not matching' ; document . getElementById ( 'submit' ). disabled = true ; ...
Short & to the point working PHP snipes.