Parse error: syntax error, unexpected end of file in

你能帮我得到一个分析错误:语法错误,在C: xampp htdocs xampp form-to-email.php文件的意外结束42行想知道你是否可以帮助我这个我很困惑...

<?php    {   
    if(!isset($_POST['submit']))
    {
    //This page should not be accessed directly. Need to submit the form.
    echo "error; you need to submit the form!";

    $name = $_POST['name'];
    $attend = $_POST['attend'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $office = $_POST['office'];
    $starter = $_POST['starter'];
    $mainmeal = $_POST['mainmeal'];
    $specialdietaryrequirements = $_POST['specialdietaryrequirements'];
    $otherdietaryrequirements = $_POST['otherdietaryrequirements'];
    $nameofguest = $_POST['nameofguest'];
    $starterguest = $_POST['starterguest'];
    $mainmealguest = $_POST['mainmealguest'];
    $guestspecialdietaryrequirements = $_POST['guestspecialdietaryrequirements'];
    $guestotherdietaryrequirements = $_POST['guestotherdietaryrequirements'];
    //email body
    $email_from = 'my@email.com';
    $email_subject = "Christmas Part Submission";
    $email_body = "You have received a new message from the user $name.n".
    "Are you attending: $attend n".
    "Email address from the person: $email n".
    "Contact number: $phone n".
    "Office: $office n".
    "Starter: $starter n".
    "Main Meal: $mainmeal n".
    "Special Dietary Requirements: $specialdietaryrequirements n".
    "Other Dietary Requirements: $otherdietaryrequirements n".
    "Name of Guest: $nameofguest n".
    "Guest Starter: $starterguest n".
    "Guest Main Meal: $mainmealguest n".
    "Guest Special Dietary requirements: $guestspecialdietaryrequirements n".
    "Guest other Dietary requirements: $guestotherdietaryrequirements n".
    // who it is being sent too (edit this)
    $to = "my@email.com";
    $headers = "From: $email_from rn";
    mail($to,$email_subject,$email_body,$headers);
    {   ?>

Replace this:

<?php    {   
if(!isset($_POST['submit']))
{

with

<?php  
if(!isset($_POST['submit']))
{

and the { at the very end of your long code should be }


By the looks of it, you forgot to close your if statement and whatever came before that. Try replacing

{

at the end of your file with

 }
}

末尾的最后一个开放式大括号必须更改为最后一个开大括号

链接地址: http://www.djcxy.com/p/69808.html

上一篇: PHP分析/语法错误意外的文件结束

下一篇: 解析错误:语法错误,文件意外结束