Why is that on fail, you populate both either a what seems to be a string variable $error and also an array $errors depending on the failure?
Where do you echo out $error?
Also, this looks very dubious to me:
$_POST['registerSubmit'] == 'true'
When the form is submitted does it really have the string value 'true' or are you looking for a boolean true?
When forking your code and things are not going as expected the very first thing you should do is var_dump() the values onto the screen somewhere, or into an error log file -- and then carefully inspect the values.
in your case:
// a line of debug
var_dump( $_POST );
Then you should be inclined to use === to make sure those values match your expectations exactly (strict, value and type match), rather than relying on the woolly == (loose, value matches only).
More here: PHP Truth table.