Well, let's take time and think about your logic:
IF the passwords are the same OR the user exists, show the form.
Otherwise, insert the record....
With that logic, I can type to passwords that match, on a client name that does exist, and it would show the form. I could use an existing client name, and non-matching passwords, and the form would show.
You're trying to check to see if the user exists, then if the user doesn't exist, if the passwords match. If the passwords match, insert, otherwise show the form. If the user exists show the form, otherwise, move on with verification....
I think this might be a little more up your alley:
if(!$client_exists)
{
// Client doesn't exist
if($_POST['password'] == $_POST['confirmpassword'])
{
// Passwords match, insert the record
}
else
{
// Passwords don't match, show the form
}
}
else
{
// User exists, show form
}
~Brett