出现意外的语法错误

scb*_*nch 0 php syntax-error

尝试创建一个表单并从教程网站获取...它在我看来我有正确数量的括号.应该少吗?无法弄清楚这个错误.

语法错误,第68行意外的'{'../ conttact.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>';
        }

    }
}
?>
Run Code Online (Sandbox Code Playgroud)

Mar*_*c B 9

你有两个else子句,这是一个语法错误.

if (...) {
  ...
} else if (...) { 
   ...
} else if (...) {
  ...
} else {  <--only ONE allowed
  ...
}
Run Code Online (Sandbox Code Playgroud)