parse error syntax error unexpected - using php sendmail

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maxamis4
    Recognized Expert Contributor
    • Jan 2007
    • 295

    #1

    parse error syntax error unexpected - using php sendmail

    Hello folks,

    Learning PHP here and I am using sendmail.php to send an email. I have setup my html contact form and I am using the following to send an email once a confirmation has been made:

    Code:
    <?php 
    
    $to = "johnDoe@hotmail.com";
    $tfirstName = $_REQUEST['fname'];
    $tlastName = $_REQUEST['lname'];
    $Zip = $_REQUEST['zip'];
    $ReqDate = $_REQUEST['ReqDate'];
    $EndDate = $_REQUEST['EndDate'];
    $DutyStation = $_REQUEST['txtPDS'];
    $TravPur = $_REQUEST['txtTDDS'];
    $TNumb1 = $_REQUEST['TN1'];
    $TNumb1 = $_REQUEST['TN2'];
    $TYPE1 = $_REQUEST['TypeOpt'];
    $TYPE2 = $_REQUEST['TypeOpt2'];
    $POV = $_REQUEST['POV'];
    $CAR = $_REQUEST['CAR'];
    $TRANS = $_REQUEST['TRANS'];
    $RIDE = $_REQUEST['Ride'];
    $COMM = $_REQUEST['txtComments'];
    $RfirstName = $_REQUEST['Rfname'];
    $RLastName = $_REQUEST['Rlname'];
    $SfirstName = $_REQUEST['Sfname'];
    $SLastName = $_REQUEST['Slname'];
    $SEmail = $_REQUEST['Semail'];
    $temail = $_REQUEST['TEmail'];
    $TravelNumber = date("YmdH:i a");
    
    //$PNumber = $_REQUEST['Phone'];
      //     if($PNumber != ""){ $strno=$PNumber; } else { $strno="-"; }    
    $subject = "NEW GITGO TRAVEL REQUEST:";
    $subject = &$TravelNumber;
    
    $message = 'The Contacts Name is: '.$tfirstName.' '.$tlastName.;
    
    $headers = "From: $email"; 
    $sent = mail($to, $subject, $message, $headers) ; 
    header( "Location: http://159.142.143.13/requests/thankyou.html" );
    if($sent) 
    {print "Your mail was sent successfully"; }
     else 
    {print "We encountered an error sending your mail"; }
    ?>
    however I keep getting the following error
    Parse error: syntax error, unexpected ';' in C:\XAMPP\xampp\ htdocs\Requests \sendmail.php on line 33

    any links or help would be greatly appreciated.
  • maxamis4
    Recognized Expert Contributor
    • Jan 2007
    • 295

    #2
    I have it working

    Please ignore I have it working. PHP is very case sensative.

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      although the error was caused by a "." …

      Comment

      • maxamis4
        Recognized Expert Contributor
        • Jan 2007
        • 295

        #4
        Just one more questión How can i cc and Bcc people in this send script.

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          pass it to the headers parameter of mail()

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by maxamis4
            Just one more questión How can i cc and Bcc people in this send script.
            php.net/mail - see example 4.

            Comment

            Working...