Connecting Tech Pros Worldwide Forums | Help | Site Map

parse error syntax error unexpected - using php sendmail

maxamis4's Avatar
Expert
 
Join Date: Jan 2007
Location: Northern VA
Posts: 217
#1: 4 Weeks Ago
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:

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2.  
  3. $to = "johnDoe@hotmail.com";
  4. $tfirstName = $_REQUEST['fname'];
  5. $tlastName = $_REQUEST['lname'];
  6. $Zip = $_REQUEST['zip'];
  7. $ReqDate = $_REQUEST['ReqDate'];
  8. $EndDate = $_REQUEST['EndDate'];
  9. $DutyStation = $_REQUEST['txtPDS'];
  10. $TravPur = $_REQUEST['txtTDDS'];
  11. $TNumb1 = $_REQUEST['TN1'];
  12. $TNumb1 = $_REQUEST['TN2'];
  13. $TYPE1 = $_REQUEST['TypeOpt'];
  14. $TYPE2 = $_REQUEST['TypeOpt2'];
  15. $POV = $_REQUEST['POV'];
  16. $CAR = $_REQUEST['CAR'];
  17. $TRANS = $_REQUEST['TRANS'];
  18. $RIDE = $_REQUEST['Ride'];
  19. $COMM = $_REQUEST['txtComments'];
  20. $RfirstName = $_REQUEST['Rfname'];
  21. $RLastName = $_REQUEST['Rlname'];
  22. $SfirstName = $_REQUEST['Sfname'];
  23. $SLastName = $_REQUEST['Slname'];
  24. $SEmail = $_REQUEST['Semail'];
  25. $temail = $_REQUEST['TEmail'];
  26. $TravelNumber = date("YmdH:i a");
  27.  
  28. //$PNumber = $_REQUEST['Phone'];
  29.   //     if($PNumber != ""){ $strno=$PNumber; } else { $strno="-"; }    
  30. $subject = "NEW GITGO TRAVEL REQUEST:";
  31. $subject = &$TravelNumber;
  32.  
  33. $message = 'The Contacts Name is: '.$tfirstName.' '.$tlastName.;
  34.  
  35. $headers = "From: $email"; 
  36. $sent = mail($to, $subject, $message, $headers) ; 
  37. header( "Location: http://159.142.143.13/requests/thankyou.html" );
  38. if($sent) 
  39. {print "Your mail was sent successfully"; }
  40.  else 
  41. {print "We encountered an error sending your mail"; }
  42. ?> 
  43.  
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.
best answer - posted by Dormilich
although the error was caused by a "." …

maxamis4's Avatar
Expert
 
Join Date: Jan 2007
Location: Northern VA
Posts: 217
#2: 4 Weeks Ago

re: parse error syntax error unexpected - using php sendmail


Please ignore I have it working. PHP is very case sensative.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,669
#3: 4 Weeks Ago

re: parse error syntax error unexpected - using php sendmail


although the error was caused by a "." …
maxamis4's Avatar
Expert
 
Join Date: Jan 2007
Location: Northern VA
Posts: 217
#4: 4 Weeks Ago

re: parse error syntax error unexpected - using php sendmail


Just one more questión How can i cc and Bcc people in this send script.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,669
#5: 4 Weeks Ago

re: parse error syntax error unexpected - using php sendmail


pass it to the headers parameter of mail()
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,950
#6: 4 Weeks Ago

re: parse error syntax error unexpected - using php sendmail


Quote:

Originally Posted by maxamis4 View Post

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

php.net/mail - see example 4.
Reply


Similar PHP bytes