After upgrading to PHP 7.0 my contact form outputs error

WordPress has a built in function for validating emails and I would advise you use that.

So you can replace your preg_match with the wordpress is_email

else if (!preg_match("/^[A-Z0-9.%-]+@[A-Z0-9.%-]+.[A-Z]{2,4}$/", trim($_POST['email']))) {
            $emailError="You entered an invalid email address.";
            $hasError = true;
        }

REPLACED WITH

else if ( ! is_email( trim( $_POST['email'] ) ) ) {
                $emailError="You entered an invalid email address.";
                $hasError = true;
            }

You should also look at the wordpress codex on Data Validation, especially the Input Validation on sanitizing user inputs before using them in your code.