we are receiving this error:
Warning: preg_match(): No ending delimiter ‘^’ found in /home/goose/public_html/wp-content/themes/goose/partials/contact.php on line 32
Please enter a valid email address
http://thegoosedarien.com – using the contact form, we receive this error message when submitting.
No idea how to resolve this. What is missing from the code?
<?php
$asset_path = get_bloginfo('template_url');
?>
<div class="left">
<span class="main-title">
<?php _e( 'Contact Us', 'goose' ); ?>
</span>
<?php
if($_SERVER['REQUEST_METHOD'] === 'POST') {
$flag = 1;
echo '<div class="notice">';
if($_POST['submission_name'] == '') {
$flag = 0;
echo "Please enter your name<br />";
} else if(!preg_match('/[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*/',
$_POST['submission_name'])) {
$flag=0;
echo "Please enter a valid name<br />";
}
if($_POST['submission_email'] == '') {
$flag = 0;
echo "Please enter your email address<br />";
} else if(!preg_match("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-
z0-9-]+)*(.[a-z]{2,3})$", $_POST['submission_email'])) {
$flag=0;
echo "Please enter a valid email address<br />";
}
if($_POST['submission_message'] == '') {
$flag = 0;
echo "Please enter a message<br />";
}
if (empty($_POST)) {
echo "Sorry, your submission is invalid - please try again!";
exit;
} else {
if($flag == 1) {
wp_mail(get_option("admin_email"),
trim($_POST[submission_name])." sent you a message from " .
get_option("blogname"), stripslashes(trim($_POST[submission_message])),"From: ".trim($_POST[submission_name])." <".trim($_POST[submission_email]).">rnReply-To:".trim($_POST[submission_email]));
echo "Submission successfully sent!<br />";
}
}
echo '</div>';
}
?>
<form method="post" parsley-validate parsley-show-errors="false"
id="contact-form">
<div class="line">
<label for="name"><?php _e( 'Your Name', 'goose' ); ?></label>
<input type="text" id="name" name="submission_name" required="required" />
</div>
<div class="line">
<label for="email"><?php _e( 'Your Email', 'goose' ); ?></label>
<input type="text" id="email" name="submission_email" required="required" parsley-type="email" />
</div>
<div class="line">
<label for="msg"><?php _e( 'Message', 'goose' ); ?></label>
<textarea id="msg" cols="10" rows="10" name="submission_message" required="required"></textarea>
</div>
<button>
<span><?php _e( 'Submit', 'goose' ); ?></span>
</button>
</form>