I have a script that takes the form submission of a user, creates a .csv and attaches it to an email, then sends the email.
The issue I have now is that I can't get the Price variable into the message body of the email. Currently is reads, "The Price is: $price." but when I receive the email it only displays "$price", not the actual value of that field.
Entire code is below.
Any ideas?
Thank
Rick
<?php
$name = $_POST["name"];
$cred = $_POST["cred"];
$title = $_POST["title"];
$phone = $_POST["phone"];
$voice = $_POST["voice"];
$cell = $_POST["cell"];
$address = $_POST["address"];
$fax = $_POST["fax"];
$email = $_POST["email"];
$company = $_POST["company"];
$price = $_POST["price"];
$cr = "\n";
$csvdata = "Name" . ',' . "Credentials" . ',' ."Title" . ',' ."Company Name" . ',' ."Company Address" . ',' ."City State Zip" . ',' ."Telephone" . ',' ."Voicemail" . ',' ."Cell" . ',' ."Fax" . ',' ."Email" . ',' .$cr;
$csvdata .= $name . ',' . $cred . ',' . $title . ',' . $company . ',' .$comaddress . ',' .$address . ',' .$phone . ',' .$voice . ',' .$cell . ',' .$fax . ',' .$email . ',' .$cr;
$thisfile = "$name.csv";
$encoded = chunk_split(base64_encode($csvdata));
// create the email and send it off
$toemail = "rk@abc.com";
$subject = "Business Card Submission from $name";
$from = "tg@abc.com";
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-Type: multipart/mixed;
boundary="----=_NextPart_001_0011_1234ABCD.4321FDAC"' . "\n";
$message = '
This is a multi-part message in MIME format.
------=_NextPart_001_0011_1234ABCD.4321FDAC
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
The Price is: $price.
------=_NextPart_001_0011_1234ABCD.4321FDAC
Content-Type: application/octet-stream; name="';
$message .= "$thisfile";
$message .= '"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="';
$message .= "$thisfile";
$message .= '"
';
$message .= "$encoded";
$message .= '
------=_NextPart_001_0011_1234ABCD.4321FDAC--
';
// now send the email
mail($toemail, $subject, $message, $headers, "-f$from");
echo("Thank you for your submission. Your order has been received.");
?>
The issue I have now is that I can't get the Price variable into the message body of the email. Currently is reads, "The Price is: $price." but when I receive the email it only displays "$price", not the actual value of that field.
Entire code is below.
Any ideas?
Thank
Rick
<?php
$name = $_POST["name"];
$cred = $_POST["cred"];
$title = $_POST["title"];
$phone = $_POST["phone"];
$voice = $_POST["voice"];
$cell = $_POST["cell"];
$address = $_POST["address"];
$fax = $_POST["fax"];
$email = $_POST["email"];
$company = $_POST["company"];
$price = $_POST["price"];
$cr = "\n";
$csvdata = "Name" . ',' . "Credentials" . ',' ."Title" . ',' ."Company Name" . ',' ."Company Address" . ',' ."City State Zip" . ',' ."Telephone" . ',' ."Voicemail" . ',' ."Cell" . ',' ."Fax" . ',' ."Email" . ',' .$cr;
$csvdata .= $name . ',' . $cred . ',' . $title . ',' . $company . ',' .$comaddress . ',' .$address . ',' .$phone . ',' .$voice . ',' .$cell . ',' .$fax . ',' .$email . ',' .$cr;
$thisfile = "$name.csv";
$encoded = chunk_split(base64_encode($csvdata));
// create the email and send it off
$toemail = "rk@abc.com";
$subject = "Business Card Submission from $name";
$from = "tg@abc.com";
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-Type: multipart/mixed;
boundary="----=_NextPart_001_0011_1234ABCD.4321FDAC"' . "\n";
$message = '
This is a multi-part message in MIME format.
------=_NextPart_001_0011_1234ABCD.4321FDAC
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
The Price is: $price.
------=_NextPart_001_0011_1234ABCD.4321FDAC
Content-Type: application/octet-stream; name="';
$message .= "$thisfile";
$message .= '"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="';
$message .= "$thisfile";
$message .= '"
';
$message .= "$encoded";
$message .= '
------=_NextPart_001_0011_1234ABCD.4321FDAC--
';
// now send the email
mail($toemail, $subject, $message, $headers, "-f$from");
echo("Thank you for your submission. Your order has been received.");
?>