I'm not a php Dev, but in any other language I use
if(!$password == $repassword) is the same as if( (!$password) == $repassword)
i.e. !password evaluates first and then is compared with $repassword
try using
if( ! ($password == $repassword ))
Regards
Richard