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:

$busmail = $_POST['field_2']

mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed.

 
Quantity: " . $_POST['field_3'] . " 
Size: " . $_POST['field_4'] . " 
Special Instructions: " . $_POST['field_5'] . " 

Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A> 
");

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.

Here is the entire script so you can see which line is 44.

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

// File upload handling
if($_FILES['field_6']['name']!=''){
$field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4);
if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){
die("File " .  $_FILES['field_6']['name'] . " was not uploaded.");
}
}

include("config.inc.php");
$link = mysql_connect($db_host,$db_user,$db_pass);
if(!$link) die ('Could not connect to database: '.mysql_error());
mysql_select_db($db_name,$link);
$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'] . "')";
mysql_query($query);
mysql_close($link);

mail("","phpFormGenerator - Form submission","Form data:

Customer Name: " . $_POST['field_1'] . " 
Customer Email: " . $_POST['field_2'] . " 
Quantity: " . $_POST['field_3'] . " 
Size: " . $_POST['field_4'] . " 
Special Instructions: " . $_POST['field_5'] . " 
Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ")
Shipping Information: " . $_POST['field_7'] . " 
Ship to Address: " . $_POST['field_8'] . " 
Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . " 
Alterations: " . $_POST['field_10'] . " 
: " . $_POST['field_11'] . " 
: " . $_POST['field_12'] . " 
: " . $_POST['field_13'] . " 
: " . $_POST['field_14'] . " 



");

$busmail = $_POST['field_2']

mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed.

 
Quantity: " . $_POST['field_3'] . " 
Size: " . $_POST['field_4'] . " 
Special Instructions: " . $_POST['field_5'] . " 

Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A> 
");

include("confirm.html");

?>
mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed.

needs to be

mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed.

yeah,no need for the quotes because it is only a variable.

Plus the quotes wernt closed off to allow for the string concantation

Ok, took out the quotes and still getting an error code. The error will follow after the code insert in this post.

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

// File upload handling
if($_FILES['field_6']['name']!=''){
$field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4);
if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){
die("File " .  $_FILES['field_6']['name'] . " was not uploaded.");
}
}

include("config.inc.php");
$link = mysql_connect($db_host,$db_user,$db_pass);
if(!$link) die ('Could not connect to database: '.mysql_error());
mysql_select_db($db_name,$link);
$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'] . "')";
mysql_query($query);
mysql_close($link);

mail("","phpFormGenerator - Form submission","Form data:

Customer Name: " . $_POST['field_1'] . " 
Customer Email: " . $_POST['field_2'] . " 
Quantity: " . $_POST['field_3'] . " 
Size: " . $_POST['field_4'] . " 
Special Instructions: " . $_POST['field_5'] . " 
Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ")
Shipping Information: " . $_POST['field_7'] . " 
Ship to Address: " . $_POST['field_8'] . " 
Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . " 
Alterations: " . $_POST['field_10'] . " 
: " . $_POST['field_11'] . " 
: " . $_POST['field_12'] . " 
: " . $_POST['field_13'] . " 
: " . $_POST['field_14'] . " 



");

$busmail = $_POST['field_2']

mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed.

 
Quantity: " . $_POST['field_3'] . " 
Size: " . $_POST['field_4'] . " 
Special Instructions: " . $_POST['field_5'] . " 

Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A> 
");

include("confirm.html");

?>

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

$busmail = $_POST['field_2'];

you forgot the semi colon on this line.
line 42.

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.

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

// File upload handling
if($_FILES['field_6']['name']!=''){
$field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4);
if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){
die("File " .  $_FILES['field_6']['name'] . " was not uploaded.");
}
}

include("config.inc.php");
$link = mysql_connect($db_host,$db_user,$db_pass);
if(!$link) die ('Could not connect to database: '.mysql_error());
mysql_select_db($db_name,$link);
$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'] . "')";
mysql_query($query);
mysql_close($link);

mail("","phpFormGenerator - Form submission","Form data:

Customer Name: " . $_POST['field_1'] . " 
Customer Email: " . $_POST['field_2'] . " 
Quantity: " . $_POST['field_3'] . " 
Size: " . $_POST['field_4'] . " 
Special Instructions: " . $_POST['field_5'] . " 
Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ")
Shipping Information: " . $_POST['field_7'] . " 
Ship to Address: " . $_POST['field_8'] . " 
Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . " 
Alterations: " . $_POST['field_10'] . " 
: " . $_POST['field_11'] . " 
: " . $_POST['field_12'] . " 
: " . $_POST['field_13'] . " 
: " . $_POST['field_14'] . " 



");

$busmail = $_POST['field_2'];

mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed.

 
Quantity: " . $_POST['field_3'] . " 
Size: " . $_POST['field_4'] . " 
Special Instructions: " . $_POST['field_5'] . " 

Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A> 
");

include("confirm.html");

?>

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

change the double quote here:

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

to single quote:

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

or to keep proper html syntax you could do this:

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

Hey guys, I can't thank you enough. I appreciate all of the comments. I did figure out the last problem. I didn't have to put the HTML formatting on the link to the email. Most email programs automatically format a link by the way it is typed. I removed the format and got no more errors. When opening the email, the link was active. Thanks again for the help.

I get this error:
PHP Parse error: parse error in D:\HostingSpaces\sachinbhatt\sachinbhatt.in\wwwroot\send_mail.php on line 73


The script is ..:

$Subject="New Inquiry";
$Message="Inquiry Details<br>";
$Message.="Name: $FullName<br>";
$Message.="Occupation: $Occupation<br>";
$Message.="Address: $Address<br>";
$Message.="City: $City<br>";
$Message.="State: $State<br>";
$Message.="Phone: $phone<br>";
$Message.="Email: $Email<br>";
$Message.="Comments: $Comments<br>";
$Headers = "From: sbhatt.salil@sachinbhatt.in"."\r\n";
$Headers .= "MIME-Version: 1.0"."\r\n";
$Headers .= "Content-type: text/html; charset=iso-8859-1"."\r\n";
$Headers .= "Content-Transfer-Encoding: 7bit"."\r\n";
$r=mail("sbhatt.salil@sachinbhatt.in",$Subject,$Message,$Headers));

if(!empty($r)){
	//header("Location:ty.html");
	echo("&status=yes");
}
else{
	echo("&status=no");
}

----------------------------------------
I am not very proficient in PHP and I have not written this script as well, but using by copy/paste from some online resource.
Can anyone please help me with this..?
Many thanks in advance...

I get this error:
PHP Parse error: parse error in D:\HostingSpaces\sachinbhatt\sachinbhatt.in\wwwroot\send_mail.php on line 73


The script is ..:

$Subject="New Inquiry";
$Message="Inquiry Details<br>";
$Message.="Name: $FullName<br>";
$Message.="Occupation: $Occupation<br>";
$Message.="Address: $Address<br>";
$Message.="City: $City<br>";
$Message.="State: $State<br>";
$Message.="Phone: $phone<br>";
$Message.="Email: $Email<br>";
$Message.="Comments: $Comments<br>";
$Headers = "From: sbhatt.salil@sachinbhatt.in"."\r\n";
$Headers .= "MIME-Version: 1.0"."\r\n";
$Headers .= "Content-type: text/html; charset=iso-8859-1"."\r\n";
$Headers .= "Content-Transfer-Encoding: 7bit"."\r\n";
$r=mail("sbhatt.salil@sachinbhatt.in",$Subject,$Message,$Headers));

if(!empty($r)){
	//header("Location:ty.html");
	echo("&status=yes");
}
else{
	echo("&status=no");
}

----------------------------------------
I am not very proficient in PHP and I have not written this script as well, but using by copy/paste from some online resource.
Can anyone please help me with this..?
Many thanks in advance...

First of all, get a good editor which error checking. If you do, you will see the error yourself.
Anyways, You have an extra ) in your mail function.

Next time, please start a new thread while posting a question.

The minute I submitted my post I re-checked the line and ......
Oops....
I found where I was going wrong..!!

in line 15:
$r=mail("sbhatt.salil@sachinbhatt.in",$Subject,$Message,$Headers));
I placed an extra.. ' ) '...! :)

Anyway.. Thanks nav33n.
Sure I will follow your guidelines. :)
Regards,
-Sachin.

Yep! Cheers :)

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.