You have this code at the bottom of your connection file:
if (mysqli_connect_errno()) {
die('<p>Failed to connect to MySQL: '.mysqli_connect_error().'</p>');
} else {
echo '<p></p >';
}
That is causing the form redirect to fail when validation fails. Just delete that code, or at least remove the else statement to make it:
if (mysqli_connect_errno()) {
die('<p>Failed to connect to MySQL: '.mysqli_connect_error().'</p>');
}