试图创建一个表单并从教程站点获取它......在我看来,我有正确数量的括号。应该少吗?无法弄清楚这个错误。
语法错误,第 68 行出现意外的 '{' ../contact.php
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: Bunch';
$to = 'me@hotmail.com';
$subject = 'Hi There!';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if ($_POST['submit']) {
if ($name != '' && $email != '') {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
} else {
echo '<p>You need to fill in all required fields!!</p>';
}
}
}
?>