我正在努力让这个联系表格起作用,但我似乎无法让它运作起来。我正在学习本教程https://www.youtube.com/watch?v=6q7ndD0rt2s,我相信我已经做好了一切,但它一直在说:
解析错误:语法错误,第80行/home1/svcck/public_html/contact.php中的文件意外结束。(第80行是我代码的最底层)。
有人可以帮助我让它工作,或通知我代码中的任何错误?感谢。
<?php
$to = 'email@mail.com';
$subject = 'this came from your Chille';
$name = $_POST['name'];
$email = $_POST['email'];
$topic = $_POST['topic'];
$message = $_POST['message'];
$body = <<<EMAIL
Hi! My name is #name, and my topic is $topic
$message
From $name
Oh ya, my email is #email
EMAIL;
$header = "From: $email";
if($_POST) {
if($name == '' || $email == '' || $message == '') {
$feedback = 'fill out all the fields!';
}else{
mail($to, $subject, $body, $header)
$feedback = "Thanks for emailing us!";
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>This is my site!</title>
<link rel='stylesheet' href='contact.css' type='text/css' media='all'>
</head>
<body>
<p id="feedback"><?php echo $feedback; ?></p>
<form action="?" method="post">
<ul>
<li>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</li>
<li>
<label for="email">Email:</label>
<input type="text" name="email" id="email" />
</li>
<li>
<label for="topic">Topic:</label>
<select id="topic" name="topic">
<option value="Ponies">Ponies</option>
<option value="Mexicans">Mexicans</option>
<option value="Weiner">Weiner</option>
</select>
</li>
<li>
<label for="message">Message:</label>
<textarea id="message" name="message" cols="42" rows="9"></textarea>
</li>
<li>
<input type="submit" value="Submit!"></li>
</li>
</ul>
</form>
</body>
</html>