You should configure your UE server behavior and apply it to the page, then move it to the correct place after the fact.
Where you have your comment after the validations run you should end the php code there, then have your UE server behavior code, then the closing brackets in a new php block like this:
} else {
?>
Universal Email server behavior code chunk here
<?php
}
}
?>
If you have any trouble with this post back with the page after you add the UE server behavior to it and I can show you where it goes.