Mail Function syntax error

Thread Solved

Join Date: Feb 2008
Posts: 12
Reputation: jjasoningram is an unknown quantity at this point 
Solved Threads: 0
jjasoningram jjasoningram is offline Offline
Newbie Poster

Mail Function syntax error

 
0
  #1
Mar 6th, 2008
I am trying to put a variable in as the value of the mail function on my script. I am relatively new to php and I may be making a simple mistake. Here is the script:

  1. $busmail = $_POST['field_2']
  2.  
  3. mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed.
  4.  
  5.  
  6. Quantity: " . $_POST['field_3'] . "
  7. Size: " . $_POST['field_4'] . "
  8. Special Instructions: " . $_POST['field_5'] . "
  9.  
  10. Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A>
  11. ");

and here is the error I am getting:

PHP Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web171/b1716/sl.c2cadmin/C2C/Form/processor.php on line 44

Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 12
Reputation: jjasoningram is an unknown quantity at this point 
Solved Threads: 0
jjasoningram jjasoningram is offline Offline
Newbie Poster

Re: Mail Function syntax error

 
0
  #2
Mar 6th, 2008
Here is the entire script so you can see which line is 44.
  1. <?php
  2.  
  3. $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
  4.  
  5. // File upload handling
  6. if($_FILES['field_6']['name']!=''){
  7. $field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4);
  8. if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){
  9. die("File " . $_FILES['field_6']['name'] . " was not uploaded.");
  10. }
  11. }
  12.  
  13. include("config.inc.php");
  14. $link = mysql_connect($db_host,$db_user,$db_pass);
  15. if(!$link) die ('Could not connect to database: '.mysql_error());
  16. mysql_select_db($db_name,$link);
  17. $query = "INSERT into `".$db_table."` (field_1,field_2,field_3,field_4,field_5,field_6,field_7,field_8,field_9,field_10,field_11,field_12,field_13,field_14) VALUES ('" . $_POST['field_1'] . "','" . $_POST['field_2'] . "','" . $_POST['field_3'] . "','" . $_POST['field_4'] . "','" . $_POST['field_5'] . "','" . $_POST['field_6'] . "','" . $_POST['field_7'] . "','" . $_POST['field_8'] . "','" . $_POST['field_9'] . "','" . $_POST['field_10'] . "','" . $_POST['field_11'] . "','" . $_POST['field_12'] . "','" . $_POST['field_13'] . "','" . $_POST['field_14'] . "')";
  18. mysql_query($query);
  19. mysql_close($link);
  20.  
  21. mail("","phpFormGenerator - Form submission","Form data:
  22.  
  23. Customer Name: " . $_POST['field_1'] . "
  24. Customer Email: " . $_POST['field_2'] . "
  25. Quantity: " . $_POST['field_3'] . "
  26. Size: " . $_POST['field_4'] . "
  27. Special Instructions: " . $_POST['field_5'] . "
  28. Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ")
  29. Shipping Information: " . $_POST['field_7'] . "
  30. Ship to Address: " . $_POST['field_8'] . "
  31. Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . "
  32. Alterations: " . $_POST['field_10'] . "
  33. : " . $_POST['field_11'] . "
  34. : " . $_POST['field_12'] . "
  35. : " . $_POST['field_13'] . "
  36. : " . $_POST['field_14'] . "
  37.  
  38.  
  39.  
  40. ");
  41.  
  42. $busmail = $_POST['field_2']
  43.  
  44. mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed.
  45.  
  46.  
  47. Quantity: " . $_POST['field_3'] . "
  48. Size: " . $_POST['field_4'] . "
  49. Special Instructions: " . $_POST['field_5'] . "
  50.  
  51. Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A>
  52. ");
  53.  
  54. include("confirm.html");
  55.  
  56. ?>
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 121
Reputation: Auzzie is an unknown quantity at this point 
Solved Threads: 16
Auzzie Auzzie is offline Offline
Junior Poster

Re: Mail Function syntax error

 
0
  #3
Mar 6th, 2008
  1. mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed.
  2.  

needs to be

  1. mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed.
  2.  
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 570
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: Mail Function syntax error

 
0
  #4
Mar 6th, 2008
yeah,no need for the quotes because it is only a variable.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 121
Reputation: Auzzie is an unknown quantity at this point 
Solved Threads: 16
Auzzie Auzzie is offline Offline
Junior Poster

Re: Mail Function syntax error

 
0
  #5
Mar 6th, 2008
Plus the quotes wernt closed off to allow for the string concantation
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 12
Reputation: jjasoningram is an unknown quantity at this point 
Solved Threads: 0
jjasoningram jjasoningram is offline Offline
Newbie Poster

Re: Mail Function syntax error

 
0
  #6
Mar 6th, 2008
Ok, took out the quotes and still getting an error code. The error will follow after the code insert in this post.

  1. <?php
  2.  
  3. $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
  4.  
  5. // File upload handling
  6. if($_FILES['field_6']['name']!=''){
  7. $field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4);
  8. if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){
  9. die("File " . $_FILES['field_6']['name'] . " was not uploaded.");
  10. }
  11. }
  12.  
  13. include("config.inc.php");
  14. $link = mysql_connect($db_host,$db_user,$db_pass);
  15. if(!$link) die ('Could not connect to database: '.mysql_error());
  16. mysql_select_db($db_name,$link);
  17. $query = "INSERT into `".$db_table."` (field_1,field_2,field_3,field_4,field_5,field_6,field_7,field_8,field_9,field_10,field_11,field_12,field_13,field_14) VALUES ('" . $_POST['field_1'] . "','" . $_POST['field_2'] . "','" . $_POST['field_3'] . "','" . $_POST['field_4'] . "','" . $_POST['field_5'] . "','" . $_POST['field_6'] . "','" . $_POST['field_7'] . "','" . $_POST['field_8'] . "','" . $_POST['field_9'] . "','" . $_POST['field_10'] . "','" . $_POST['field_11'] . "','" . $_POST['field_12'] . "','" . $_POST['field_13'] . "','" . $_POST['field_14'] . "')";
  18. mysql_query($query);
  19. mysql_close($link);
  20.  
  21. mail("","phpFormGenerator - Form submission","Form data:
  22.  
  23. Customer Name: " . $_POST['field_1'] . "
  24. Customer Email: " . $_POST['field_2'] . "
  25. Quantity: " . $_POST['field_3'] . "
  26. Size: " . $_POST['field_4'] . "
  27. Special Instructions: " . $_POST['field_5'] . "
  28. Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ")
  29. Shipping Information: " . $_POST['field_7'] . "
  30. Ship to Address: " . $_POST['field_8'] . "
  31. Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . "
  32. Alterations: " . $_POST['field_10'] . "
  33. : " . $_POST['field_11'] . "
  34. : " . $_POST['field_12'] . "
  35. : " . $_POST['field_13'] . "
  36. : " . $_POST['field_14'] . "
  37.  
  38.  
  39.  
  40. ");
  41.  
  42. $busmail = $_POST['field_2']
  43.  
  44. mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed.
  45.  
  46.  
  47. Quantity: " . $_POST['field_3'] . "
  48. Size: " . $_POST['field_4'] . "
  49. Special Instructions: " . $_POST['field_5'] . "
  50.  
  51. Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A>
  52. ");
  53.  
  54. include("confirm.html");
  55.  
  56. ?>

PHP Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web171/b1716/sl.c2cadmin/C2C/Form/processor.php on line 44
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 570
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: Mail Function syntax error

 
0
  #7
Mar 6th, 2008
  1. $busmail = $_POST['field_2'];

you forgot the semi colon on this line.
line 42.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 12
Reputation: jjasoningram is an unknown quantity at this point 
Solved Threads: 0
jjasoningram jjasoningram is offline Offline
Newbie Poster

Re: Mail Function syntax error

 
0
  #8
Mar 6th, 2008
Ok Guys,
This is for you in particular, Ryan. Thanks for the help so far. I feel that this may be the last issue with the script.

  1. <?php
  2.  
  3. $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
  4.  
  5. // File upload handling
  6. if($_FILES['field_6']['name']!=''){
  7. $field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4);
  8. if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){
  9. die("File " . $_FILES['field_6']['name'] . " was not uploaded.");
  10. }
  11. }
  12.  
  13. include("config.inc.php");
  14. $link = mysql_connect($db_host,$db_user,$db_pass);
  15. if(!$link) die ('Could not connect to database: '.mysql_error());
  16. mysql_select_db($db_name,$link);
  17. $query = "INSERT into `".$db_table."` (field_1,field_2,field_3,field_4,field_5,field_6,field_7,field_8,field_9,field_10,field_11,field_12,field_13,field_14) VALUES ('" . $_POST['field_1'] . "','" . $_POST['field_2'] . "','" . $_POST['field_3'] . "','" . $_POST['field_4'] . "','" . $_POST['field_5'] . "','" . $_POST['field_6'] . "','" . $_POST['field_7'] . "','" . $_POST['field_8'] . "','" . $_POST['field_9'] . "','" . $_POST['field_10'] . "','" . $_POST['field_11'] . "','" . $_POST['field_12'] . "','" . $_POST['field_13'] . "','" . $_POST['field_14'] . "')";
  18. mysql_query($query);
  19. mysql_close($link);
  20.  
  21. mail("","phpFormGenerator - Form submission","Form data:
  22.  
  23. Customer Name: " . $_POST['field_1'] . "
  24. Customer Email: " . $_POST['field_2'] . "
  25. Quantity: " . $_POST['field_3'] . "
  26. Size: " . $_POST['field_4'] . "
  27. Special Instructions: " . $_POST['field_5'] . "
  28. Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ")
  29. Shipping Information: " . $_POST['field_7'] . "
  30. Ship to Address: " . $_POST['field_8'] . "
  31. Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . "
  32. Alterations: " . $_POST['field_10'] . "
  33. : " . $_POST['field_11'] . "
  34. : " . $_POST['field_12'] . "
  35. : " . $_POST['field_13'] . "
  36. : " . $_POST['field_14'] . "
  37.  
  38.  
  39.  
  40. ");
  41.  
  42. $busmail = $_POST['field_2'];
  43.  
  44. mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed.
  45.  
  46.  
  47. Quantity: " . $_POST['field_3'] . "
  48. Size: " . $_POST['field_4'] . "
  49. Special Instructions: " . $_POST['field_5'] . "
  50.  
  51. Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A>
  52. ");
  53.  
  54. include("confirm.html");
  55.  
  56. ?>
PHP Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web171/b1716/sl.c2cadmin/C2C/Form/processor.php on line 51
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 570
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: Mail Function syntax error

 
0
  #9
Mar 6th, 2008
change the double quote here:

  1. <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A>

to single quote:

  1. <A href='mailto:c2c@capturedtocanvas.com' target=_top>c2c@capturedtocanvas.com</A>
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Mail Function syntax error

 
0
  #10
Mar 6th, 2008
or to keep proper html syntax you could do this:

  1. <A href=\"mailto:c2c@capturedtocanvas.com\" target=_top>c2c@capturedtocanvas.com</A>
  2.  
Last edited by kkeith29; Mar 6th, 2008 at 10:34 pm.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1975 | Replies: 10
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC