Hi,
I’ve ran my php code through a validator and fixed up the problems, but when I press the submit button on my website it still throws errors. I don’t have a clue what to fix.
– indicates error line
<?php $recipient = 'myemail.com'; $email = $_POST['email']; $subject = $_POST['subject']; $yourname = $post['yourname']; //required $deliveryaddress = $_post['deliveryaddress']; //required $youremail = $_post['youremail']; $contactnumber = $_post['contactnumber']; //required $deliverydate = $_post['deliverydate']; //required $comment = $_post['comment']; if (!preg_match("/^[\w\+\-.~]+\@[\-\w\.\!]+$/", $youremail)) $messages[] = "This is not a valid email address."; if (!preg_match("/^[\w\ \+\-\'\"\]+$/", $yourname)) -- $messages[] = "This required field was left blank."; if (!preg_match("/^[\w\+\-\'\"\ \,\]+$/", $deliveryaddress)) -- $messages[] = "This required field was left blank."; if (!preg_match("/^[\w\(\)\,\]+$/", $contactnumber)) -- $messages[] = "This required field was left blank."; if (!preg_match("/^[\w\]+$/", $deliverydate)) -- $messages[] = "This required field was left blank."; if (!preg_match("/^[\w\+\-\'\"\ \.\,\(\)\?\!\]+$/", $comment)) { -- }else { #Send email mail("myemail.com", "New order", $body, "From: $yourname <$youremail>\r\n" . "Reply-To: $yourname <$youremail>\r\n"); echo("Your order has been sent. Thank you!
\n"); } ?>These are the errors:
Warning: preg_match() [function.preg-match]: Compilation failed: missing terminating ] for character class at offset 17 in /home3/vegiepat/public_html/vegiepatchbh/email.php on line 16
Warning: preg_match() [function.preg-match]: Compilation failed: missing terminating ] for character class at offset 19 in /home3/vegiepat/public_html/vegiepatchbh/email.php on line 19
Warning: preg_match() [function.preg-match]: Compilation failed: missing terminating ] for character class at offset 14 in /home3/vegiepat/public_html/vegiepatchbh/email.php on line 22
Warning: preg_match() [function.preg-match]: Compilation failed: missing terminating ] for character class at offset 8 in /home3/vegiepat/public_html/vegiepatchbh/email.php on line 25
Warning: preg_match() [function.preg-match]: Compilation failed: missing terminating ] for character class at offset 29 in /home3/vegiepat/public_html/vegiepatchbh/email.php on line 28
Your help is really appreciated.