PHP Syntax Error Issues

Hi,

I’m having an issue with the php file below. Line 350, just after the final ?> is showing a syntax error and i can’t work out what the issue is. If i delete some coding, the syntax error just moves to the last line. I’ve tried copy-pasting it into another file but the same issue occurs. Any help would be greatly appreciated. Sorry the file is quite long.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en” lang=“en”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1” />
<title>Add Booking</title>
</head>
<?php
include (’./mainMenuUser.php’);
?>
<body>
<?php # Script 13.1 - add_booking.php
//This page allows admin to add facility booking

require_once (’…/mysql_connect.php’);

if(isset($_POST[‘submitted’])) {

//Validate data
$errors = array();

//Check for customer first name
if(!empty($_POST['firstname'])) {
    $pn = trim($_POST['firstname']);
} else{
    $errors[] = 'Please enter the customer\'s First Name.';
}

//Check for customer last name
if(!empty($_POST['lastname'])) {
    $pn = trim($_POST['lastname']);
} else{
    $errors[] = 'Please enter the customer\'s Last Name.';
}

// Check for e-mail address
if (!empty($_POST['email'])) {
    $e[] = trim($_POST['email']);
}else {
    $errors[] = 'You forgot to enter the customer\'s e-mail address.';
}

// Check for telephone number
if (!empty($_POST['tel'])) {
    $tn = trim($_POST['tel']);
}else {
    $errors[] = 'You forgot to enter the customer\'s telephone number.';
}

// Check for function type
if (!empty($_POST['function_type'])) {
    $ft = trim($_POST['function_type']);
}else {
    $errors[] = 'You forgot to enter the function type.';
    
}    // Check for function room
if (!empty($_POST['function_room'])) {
    $fr = trim($_POST['function_room']);
}else {
    $errors[] = 'You forgot to enter the function room.';
}

// Check for date
if (!empty($_POST['date'])) {
    $d = trim($_POST['date']);    
}else {
    $errors[] = 'You forgot to enter the date of the function.';
}

// Check for time
if (empty($_POST['time'])) {
    $t = trim($_POST['time']);
}else {
    $errors[] = 'You forgot to enter the time of the function.';
}

// Check for bar requirement
if (!empty($_POST['bar'])) {
    $b = trim($_POST['bar']);
}else {
    $errors[] = 'You forgot to enter whether a bar is required.';
}

// Check for bar extension requirement
if (!empty($_POST['extension'])) {
    $ex = trim($_POST['extension']);
}else {
    $errors[] = 'You forgot to enter whether a bar extension is required.';
}

// Check for catering requirement
if (!empty($_POST['catering'])) {
    $c = trim($_POST['catering']);
}else {
    $errors[] = 'You forgot to enter whether catering is required.';
}

// Check for DJ requirement
if (!empty($_POST['dj'])) {
    $dj = trim($_POST['dj']);
}else {
    $errors[] = 'You forgot to enter whether a DJ is required.';
}

//Validate booking
if(isset($_POST['booking']) && ($_POST['booking']  == 'new') ) {
    //If new booking, add to database
    
    //Check for firstname
    if(!empty($_POST['firstname'])) {
        $fn = trim($_POST['firstname']);
    
    //Check for lastname
    if(!empty($_POST['lastname'])) {
        $ln = trim($_POST['lastname']);
        
    //Check for e-mail
    if(!empty($_POST['email'])) {
        $e = trim($_POST['email']);
        
    //Check for telephone number
    if(!empty($_POST['tel'])) {
        $tn = trim($_POST['tel']);
            
    //Check for function type
    if(!empty($_POST['function_type'])) {
        $ft = trim($_POST['function_type']);
    
    //Check for function room
    if(!empty($_POST['function_room'])) {
        $fr = trim($_POST['function_room']);
            
    //Check for date
    if(!empty($_POST['date'])) {
        $d = trim($_POST['date']);
    
    //Check for time
    if(!empty($_POST['time'])) {
        $t = trim($_POST['time']);
        
    //Check for bar requirement
    if(!empty($_POST['bar'])) {
        $b = trim($_POST['bar']);
    
    //Check for extension requirement
    if(!empty($_POST['extension'])) {
        $ex = trim($_POST['extension']);
    
    //Check for catering requirement
    if(!empty($_POST['catering'])) {
        $c = trim($_POST['catering']);
    
    //Check for DJ requirement
    if(!empty($_POST['dj'])) {
        $dj = trim($_POST['dj']);
                            
        //Add booking to database
        $q = 'INSERT INTO Booking (firstname, lastname, email, tel, function_type, function_room, date, time, bar, extension, catering, dj) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
        $stmt = mysqli_prepare($db, $q);
        mysqli_stmt_bind_param($stmt, 'sss', $fn, $ln, $e, $tn, $ft, $fr, $d, $t, $b, $ex, $c, $d);
        mysqli_stmt_execute($stmt);
        
        //Check results
        if(mysqli_stmt_affected_rows($stmt) == 1) {
            echo '&lt;p&gt;The booking has been added.&lt;/p&gt;';
            $a = mysqli_stmt_insert_id($stmt);
        } else{
            $errors[] = 'The booking could not be added to the database.';
        }
        
        //Close statement
        mysqli_stmt_close($stmt);
        
    }else {
        $errors[] = 'Please enter the booking details.';
    }

}elseif (isset($_POST[‘lastname’]) AND isset($_POST[‘function_type’]) AND isset($_POST[‘date’]) && ($_POST[‘lastname’] AND ($_POST[‘function_type’]) AND ($_POST[‘date’]) == ‘existing’) && ($_POST[‘existing’] > 0) ) {
$a = (int) $_POST[‘existing’];
} else{
$errors[] = ‘Please enter or select booking.’;
}

//if(empty($errors)) {
//Validate booking
if(isset($_POST[‘customers’]) && ($_POST[‘customers’] == ‘new’) ) {
//If new booking, add to database

    //Check for firstname
    if(!empty($_POST['firstname'])) {
        $fn = trim($_POST['firstname']);
    
    //Check for lastname
    if(!empty($_POST['lastname'])) {
        $ln = trim($_POST['lastname']);
        
    //Check for e-mail
    if(!empty($_POST['email'])) {
        $e = trim($_POST['email']);
        
    //Check for telephone number
    if(!empty($_POST['tel'])) {
        $tn = trim($_POST['tel']);

//Add customer to database
$q = 'INSERT INTO customers (cust_id, firstname, lastname, email, tel) VALUES (?, ?, ?, ?, ?)';
$stmt = mysqli_prepare($dbc, $q);
mysqli_stmt_bind_param($stmt, 'isdsss', $fn, $ln, $e, $tn);
mysqli_stmt_execute($stmt);

//Check results
if(mysqli_stmt_affected_rows($stmt) == 1) {
    
    //Print message
    echo '&lt;p&gt;The customer has been added.&lt;/p&gt;';
    
    $_POST = array();
    
} else{
    echo '&lt;p style="font-weight: bold; color: #C00"&gt;Your entry could not be processed due to a system error.&lt;/p&gt;';
}

mysqli_stmt_close($stmt);

}

//Display form
?>
<h2>Add Booking</h2>
<form enctype=“multipart/form_data” action=“add_booking.php” method=“post”>
<fieldset><legend>Please fill complete the form to add a booking to the database:</legend>

<div><b>Customer:</b>
<p><input type=“radio” name=“customer” value=“existing” <?php if (isset($_POST[‘customers’]) && ($_POST[‘customers’] == ‘existing’) ) echo ’ checked=“checked”’; ?>/> Existing =>
<select name=“existing”><option>Select One</option>
<?php
$q = “SELECT cust_id, COCNAT_WS(’ ', firstname, lastname, tel, email) FROM customers ORDER BY lastname, firstname ASC”;
$r = mysqli_query($db, $q);
if(mysqli_num_rows($r) > 0) {
while ($row = mysqli_fetch_array ($r, MYSQL_NUM)) {
echo “<option value=”$row[0]"";
//Check for stickyness
if(isset($_POST[‘existing’]) && ($_POST[‘existing’] == $row[0]) ) echo ’ selected=“selected”’;
}
} else{
echo ‘<option>Please add a new customer.</option>’;
}
mysqli_close($db);
?>
</select></p>

<p><input type=“radio” name=“artist” value=“new” <?php if (isset($_POST[‘customers’]) && ($_POST[‘customers’] == ‘new’) ) echo ’ checked=“checked”’; ?>" /> New =>
First Name: <input type=“text” name=“firstname” size=“10” maxlength=“15” value="<?php if (isset($_POST[‘firstname’])) echo $_POST[‘firstname’]; ?>" />
Last Name: <input type=“text” name=“lastname” size=“10” maxlength=“30” value="<?php if (isset($_POST[‘lastname’])) echo $_POST[‘lastname’]; ?>" />
Telephone Number: <input type=“text” name=“tel” size=“11” maxlength=“11” value="<?php if (isset($_POST[‘tel’])) echo $_POST[‘tel’]; ?>" />
E-mail Address: <input type=“text” name=“email” size=“30” maxlength=“60” value="<?php if (isset($_POST[‘email’])) echo $_POST[‘email’]; ?>" />
</div>

<p><b>Function Type:</b> <input type=“text” name=“function_type” size=“30” maxlength=“50” value="<?php if (isset($_POST[‘function_type’])) echo $_POST[‘function_type’]; ?>" /></p>

<p><b>Function Room:</b>
<select name=“function_room” value="<?php if (isset($_POST[‘time’])) echo $_POST[‘time’]; ?>" </p>>
<option value=“Bradley Room”>Bradley Room</option>
<option value=“Back Bar”>Back Bar</option>
<option value=“Members Bar”>Members Bar</option>
<option value=“Pitch”>Pitch</option>
</select>

<p><b>Time of function:</b>
<select name=“time” value="<?php if (isset($_POST[‘time’])) echo $_POST[‘time’]; ?>" </p>
<option value=“7pm til 12am”>Evening</option>
<option value=“9am til 1pm”>Morning</option>
<option value=“1pm til 6pm”>Afternoon</option>
<option value=“All Day”>All Day</option>
</select>

<p><b>Bar Required?:</b><input type=“radio” name=“bar” value="<?php if (isset($_POST[‘bar’])) echo $_POST[‘bar’]; ?>" </p>
<select name=“bar”>
<option value=“Yes”>Yes</option>
<option value=“No”>No</option>
</select>

<p><b>Bar Extension Required?:</b><input type=“radio” name=“extension” value="<?php if (isset($_POST[‘extension’])) echo $_POST[‘extension’]; ?>" </p>
<select name=“extension”>
<option value=“Yes”>Yes</option>
<option value=“No”>No</option>
</select>

<p><b>Catering Required?:</b><input type=“radio” name=“catering” value="<?php if (isset($_POST[‘catering’])) echo $_POST[‘catering’]; ?>" </p>
<select name=“catering”>
<option value=“Yes”>Yes</option>
<option value=“No”>No</option>
</select>

<p><b>DJ Required?:</b><input type=“radio” name=“dj” value="<?php if (isset($_POST[‘dj’])) echo $_POST[‘dj’]; ?>" </p>
<select name=“dj”>
<option value=“Yes”>Yes</option>
<option value=“No”>No</option>
</select>

<p><b>Date of function:</b>
<?php # Script 2.5 - calendar.php
function make_calendar_pulldowns($m = NULL, $d = NULL, $y = NULL) {

// Creates array for months
$months = array (1 => ‘January’, ‘February’, ‘March’, ‘April’, ‘May’, ‘June’, ‘July’, ‘August’, ‘September’, ‘October’, ‘November’, ‘December’);

// Creates months pull-down menu
echo ‘<select name=“months”>’;
foreach ($months as $key => $value) {
echo “<option value=”$key"";
if ($key == $m) {
echo ’ selected=“selected”’;
}
echo ">$value</option>
";
}
echo ‘</select>’;

// Create days pull-down menu
echo ‘<select name=“days”>’;
for ($days = 1; $days <= 31; $days++) {
echo “<option value=”$days"";
if ($days == $d) {
echo ’ selected=“selected”’;
}
echo ">$days</option>
";
}
echo ‘</select>’;

// Create years pull-down menu
echo ‘<select name=“years”>’;
for ($years = 2011; $years <= 2020; $years++) {
echo “<option value=”$years"";
if ($years == $y) {
echo ’ selected=“selected”’;
}
echo ">$years</option>
";
}
echo ‘</select>’;
}

// Get today’s information and call function
$dates = getdate();
make_calendar_pulldowns ($dates[‘mon’], $dates[‘mday’], $dates[‘year’]);

// Print current day and time
echo '<p>Today is ’ . date (‘l’) . ’ . The current time is ’ . date (‘g:i a’) .
‘.</p>’;

?>

</fieldset>

<div align=“center”><input type=“submit” name=“submit” value=“Submit” /></div>
<input type=“hidden” name=“submitted” value=“TRUE” />

</form>

</body>
</html>