Emailing to table field result using PHP form

2 posts by 2 authors in: Forums > CMS Builder
Last Post: May 8, 2011   (RSS)

By (Deleted User) - May 6, 2011

I have a multi-record set up that includes an email field
<?php echo $dealersRecord['email'] ?>

I want to use that email address as the "TO" field when I email a particular person the result of a form.

My form currently uses a standard email in the $to field. I'd like to CC that plain email address and have the $to email address be the result of <?php echo $dealersRecord['email'] ?>

BELOW Is the form processing. Your feedback is appreciated. Thanks.

<?
$first = $_POST['first'];
$last = $_POST['last'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$interest = $_POST['interest'];
$additional = $_POST['additional'];
$to = "myemail@yahoo.com";
$subject = "Subject";
$subject2 = "No Reply: We've received your message.";
$body = "Please contact the following person:

Name: $first $last
Phone: $phone
Email Address: $email
Interested In: $interest
Additional Information: $additional

";
$body2 = "Thank you so much for taking an interest in our work and we will be in contact with you shortly.";
$header = "From: $email\n";
$header2 = "From: Us";
mail($to, $subject, $body, $header);
mail($email, $subject2, $body2, $header2);
echo "

<h1>Thank you for contacting us.</h1>
<p>Your request has been received and someone will respond shortly.</p>
"?>