Jump to content

php contact form auto-responder


jasonmilburn

Recommended Posts

I have built a form which uses PHP to email the information at http://www.rogerworthington.com . It works fine, but hte client now wants hte form to also email to the person who filled it out. I tried a couple things and couldn't get it to work. Any help would be appreciated! Here is the PHP code that handles the form:

 

<?php

if(isset($_POST['Submit'])) {

$to = "jason@jasonmilburn.com";

$subject = "MESOTHELIOMA Request For More Information";

 

foreach($_POST['check'] as $value) {

$check_msg .= "Checked: $value\n";

}

 

$type = $_POST['type'];

$ifother = $_POST['ifother'];

 

$name_field = $_POST['name'];

$phone = $_POST['phone'];

$confirmphone = $_POST['phone2'];

$email_field = $_POST['email'];

$confirmemail = $_POST['email2'];

$address_field = $_POST['address'];

$city_field = $_POST['city'];

$state_field = $_POST['state'];

$zip_field = $_POST['zip'];

$time = $_POST['time'];

$claim = $_POST['claim'];

$exposed = $_POST['exposed'];

 

 

 

$body = "Diagnosed with Mesothelioma? $check_msg\n

Type of Mesothelioma: $type\n

If Other: $ifother\n \n

Name: $name_field\n

Phone: $phone\n

COnfirm Phone: $confirmphone\n

E-Mail: $email_field\n

Confirm E-Mail: $confirmemail\n

Address: $address_field\n

City: $city_field\n

State: $state_field\n

Zip Code: $zip_field\n

Best Time To Call: $time\n

Claim is For: $claim\n

I was exposed to Asbestos: $exposed\n

";

 

echo "Thank you for contacting us.";

mail($to, $subject, $body);

} else {

echo "Error!";

}

?>

Link to comment
Share on other sites

ok ill try that.

 

I also thought I could just stick the email result right in the to line like this:

 

$to = "jason@jasonmilburn.com, $email_field";

 

So it would send the form to both emails. Or can I just stick a line like this right under the existing mail line:

 

mail($email_field, $subject, $body);

 

or does the mail function have to have a $to value in order to understand it is an email address?

Link to comment
Share on other sites

 

This will not work:

$to = "jason@jasonmilburn.com, $email_field"; 

 

 

change to:

 

$to = "jason@jasonmilburn.com"($email_field); 

 

 

 

 

i guess this will not work

 

$to = "jason@jasonmilburn.com"($email_field); 

try

$to = "jason@jasonmilburn.com,". $email_field; 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.