Looks like the problem is that $errors is not initialized until you are inside the first IF block, but you are calling the function with the error in the ELSE that follows. The exact solution will depend on the way you want the logic to flow. As it is now, the function only gets called if the IF condition fails, which means it will never get called with any errors, since all the error-checking is in the IF block.
What I think you want is something like:
$errors = array(); // init to empty array
if(isset($_POST['register']))
{
// do all the form validation, then...
if(empty($errors))
{
// do database update, then if everything is cool,
// perhaps redirect to success page?
header('Location: http://www.yoursite.com/success.php');
exit;
}
}
showRegisterForm($errors); // no need for else