I have a reservation page at Click Here I get the following error when submitting the form to email Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/orlandos/public_html/reservations/res1.php on line 55

Below is that coding any help would be great. the server is running php 5.2.17.

<?php
require_once "Mail.php";
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "email address to send to";
    $email_subject = "Reservation for Innovative Luxury Coaches";

    $first_name = $_POST['element_1'];
    $last_name = $_POST['element_2'];
    $phone_number = $_POST['element_3'];
    $email_from = $_POST['element_4'];
    $date_of_pickup = $_POST['element_5'];
    $pickup_location = $_POST['element_6'];
    $flight_number = $_POST['element_7'];
    $name_of_airline = $_POST['element_8'];
    $number_of_passengers = $_POST['element_14'];
    $one_way_round_trip = $_POST['element_15'];
    $return_date = $_POST['element_9'];
    $time_of_return = $_POST['element_10'];
    $car_seat_or_booster_seat = $_POST['element_16'];
    $grocery_stop = $_POST['element_17'];
    $comments = $_POST['element_12'];


    $email_message = "Reservation details below.\n\n";

    $email_message = "First Name: $first_name \r\n";
    $email_message = "Last Name: $last_name \r\n";
    $email_message = "Phone Number: $phone_number\r\n";
    $email_message = "Email Address: $email_from\r\n";
    $email_message = "Date Of Pickup $date_of_pickup\r\n";
    $email_message = "Pickup location $pickup_location\r\n";
    $email_message = "Flight Number $flight_number\r\n";
    $email_message = "Airline $name_of_airline\r\n";
    $email_message = "Number of passengers $number_of_passengers\r\n";
    $email_message = "Travel Status $one_way_round_trip\r\n";
    $email_message = "Return Date: $return_date\r\n";
    $email_message = "Return Time: $return_time\r\n";
    $email_message = "Child Device: $car_seat_or_booster_seat\r\n";
    $email_message = "Grocery Stop $grocery_stop\r\n";
    $email_message = "Comments: $comments\r\n";
$host = "my mail host is here";
$username = "my email address is here";
$password = "and password is here";


$headers = array ('From' => $email_from,
'Reply-To' => $email_from,
'Subject' => $email_subject);
 $smtp = Mail::factory('smtp',
   array ('host' => $host,
     'auth' => true,
     'username' => $username,
     'password' => $password));

$mail=smtp->send($email_to, $headers, $email_message);
 if (PEAR::isError($mail)) {
   echo("" . $mail->getMessage() . "");
  } else {
   echo("<p>Message successfully sent!</p>");
  }
 ?>

Dollar sign is missing:

$mail = $smtp->send($email_to, $headers, $email_message);

yay!! that fixedfixed that issue however now its only sending the lastline of the email_message which is comments.

$email_message = "Reservation details below.\n\n";
    $email_message .= "First Name: $first_name \r\n";
    $email_message .= "Last Name: $last_name \r\n";
    $email_message .= "Phone Number: $phone_number\r\n";
    $email_message .= "Email Address: $email_from\r\n";
    $email_message .= "Date Of Pickup $date_of_pickup\r\n";
    $email_message .= "Pickup location $pickup_location\r\n";
    $email_message .= "Flight Number $flight_number\r\n";
    $email_message .= "Airline $name_of_airline\r\n";
    $email_message .= "Number of passengers $number_of_passengers\r\n";
    $email_message .= "Travel Status $one_way_round_trip\r\n";
    $email_message .= "Return Date: $return_date\r\n";
    $email_message .= "Return Time: $return_time\r\n";
    $email_message .= "Child Device: $car_seat_or_booster_seat\r\n";
    $email_message .= "Grocery Stop $grocery_stop\r\n";
    $email_message .= "Comments: $comments\r\n";

message body not concatinate use this

You should add a period on the $email_message for it to work. Like this;

 $email_message = "Child Device: $car_seat_or_booster_seat\r\n";
    $email_message.= "Grocery Stop $grocery_stop\r\n";
    $email_message.= "Comments: $comments\r\n";

This will concatenate the email_message into one smooth message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.