PHP dosyası beklenmeyen $ sonu

0 Cevap

Ben bir PHP iletişim formu üzerinde çalışıyorum, ama işe alınamıyor. Ben Ubuntu Sunucu VM üzerinde çalışan Apache sunucu günlüğüne aşağıdaki hatayı alıyorum:

PHP Parse error:  syntax error, unexpected $end in /home/matthew/Sites/contactFormResponse.php on line 75, referer: http://192.168.1.4/contactForm.php

Normalde sunucu onları tanımak için kurulmuş değil zaman kısa PHP etiketini kullanarak ya da neden oluyor gibi bu hatayı Googling itibaren, o sesler, ya da doğru kapalı değil kod bloğunu alarak. Ama bildiğim kadarıyla burada durum böyle değil gördüğünüz gibi - bildiğim kadarıyla gördüğünüz gibi hepsi doğru kapalı bulunuyor. Bu ifade satır dosyanın sonunun bir çizgidir.

Burada PHP kodu:

 <?php
                                    error_reporting(E_ALL);
                                    // Define variables to hold the name, email address and message, and import the information into the variables
                                    $name = $_POST['NameInput'];
                                    $email = $_POST['EmailAddress'];
                                    $telno = $_POST['ContactNumber'];
                                    $querytype = $_POST['QueryType'];
                                    $bookingstartdate = $_POST['BookingStartDay'] . $_POST['BookingStartMonth'] . $_POST['BookingStartYear'];
                                    $bookingenddate = $_POST['BookingEndDay'] . $_POST['BookingEndMonth'] . $_POST['BookingEndYear'];
                                    $message = $_POST['QueryText'];

                                    // Validate the inputs - send it if it's OK
                                    if(3 < strlen($name) && 3 < strlen($email))
                                    {
                                            $email_message = <<< EMAIL
                                                    Message from contact form at holidaychalet.co.uk
                                                    Name: $name
                                                    Email: $email
                                                    Contact Number: $telno
                                                    Query Type: $querytype
                                                    Booking Start Date: $bookingstartdate
                                                    Booking End Date: $bookingenddate
                                                    The message:
                                                    $message
                                                    EMAIL;
                                            $headers = "cc:me@myemailaddress.com\r\n";
                                            if(mail('matthew@localhost','Contact form email', $email_message, $headers))
                                            {
                                                    echo "Thanks for completing the form! I'll be in touch shortly!";
                                            }
                                            else
                                            {
                                                    echo "Something went wrong - please use the back button and try again";
                                            }
                                    }
                                    else
                                    {
                                            echo "You didn't complete the form fully enough! Please use go back using your web browser's back button";
                                    }
                            ?>

0 Cevap