Let’s talk about what happens when a user signs up for a new account. He fills in his nickname, e-mail address and password and clicks Register. When validating the e-mail address you need to check for at least three things:
- the user provided one
- the syntax is all right – the e-mail is formally valid and can in fact exist (which doesn’t mean it really exists)
- the address hasn’t been used yet for some other account
So far not very difficult.
The tricky part comes when you allow the user to edit his profile. He can change any of the three values. When he submits the edit form the situation is one step more difficult than during registration. The e-mail address has in fact already been used – for the very user that is submitting the form. That is not the tricky part. The fun is how to get the user id when validating his e-mail address.

