This script will keep your visitors from submitting their form until their 'password' and 're-enter password' fields match, for verification purposes. They get an error message telling them to re-enter the passwords if they do not match.
Note that usually <input type="password"> fields would be used, so that the password being entered is masked by asterisks from prying eyes, but I've used ordinary <input type="text"> fields so you can see what happens more easily.