PHP表单语法错误


PHP Form syntax error

我再次尝试做一个简单的联系人表单来发送电子邮件,

这就是代码:

<?php
if (empty($_POST) === false) {
   $errors = array();
   $name     = $_POST['name'];
   $email    = $_POST['email'];
   $message  = $_POST['message'];
   echo $name,' ', $email, ' ', $message;
   if (empty($name) === true || empty($email) === true || empty($message) === true) {
    $errors[] = 'name,email and message are required';
   } else{
     if(filter_var($email,FILTER_VALIDATE_EMAIL) === false){
        $errors[] = 'that''s not a valid email address';
     }
      if(ctype_alpha($name) === false) {
      	$errors ='name must only contain letters';
      }
}
if (empty($errors) ===true) {
	mail('talrod160@gmail.com','contact form','$message','From:' . $email);
	header('location:index.php?sent');
	exit();
}
?>
<!DOCTYPE html>
<html>
	<head>
		<title>A contact form</title>
	</head>
    <body>
    <?php
    if (isset($GET ['sent']) === true) {
     echo '<p>Thanks for contact us<?/p>';
   
    } else {
    	if (empty($errors) === false) {
          echo '<ul>';
          foreach($errors as $error) {
            echo '<li>', $error, '</li>';
          }
           echo '</ul>';
    	}
    	?>
    	<form action="" method="post">
          <p>
          	 <label for="name">Name:</label><br>
          	 <input type="text" name="name" id="name" <?php if (isset($_POST['name']) === true){echo ($_POST['name']), '"'} ?>>
         </p>
         <p>
          	 <label for="email">Email:</label><br>
          	 <input type="text" name="email" id="email"<?php if (isset($_POST['email']) === true){echo 'value="', ($_POST['email']), '"'} ?>>
       	</p>
         <p>
          	 <label for="message">Message:</label><br>
          	 <textarea name="message" id="message"><?php if (isset($_POST['message']) === true) { echo strip_tags ($_POST['message']); } ?></textarea>
        </p>
        <p>
        <input type="submit" value="Submit">
       </p>
        </form>
        <?php
         }
        ?>        
    </body>
</html>

现在我遇到这个问题,不明白为什么,

解析错误:语法错误,'<'在D:'xampp'htdocs'contact_form'index.php第46行

和想如果有人可以解释我我关于foreach循环

谢谢。

<p>Thanks for contact us<?/p>可能应该是<p>Thanks for contact us</p>