jasonmilburn Posted September 3, 2007 Share Posted September 3, 2007 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!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67831-php-contact-form-auto-responder/ Share on other sites More sharing options...
TutorMe Posted September 3, 2007 Share Posted September 3, 2007 I think you could just do something like $to = "admin@yoursite.com", $_REQUEST[from]; I could be wrong though. Quote Link to comment https://forums.phpfreaks.com/topic/67831-php-contact-form-auto-responder/#findComment-340948 Share on other sites More sharing options...
jasonmilburn Posted September 4, 2007 Author Share Posted September 4, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/67831-php-contact-form-auto-responder/#findComment-341054 Share on other sites More sharing options...
darkfreaks Posted September 4, 2007 Share Posted September 4, 2007 This will not work: $to = "jason@jasonmilburn.com, $email_field"; change to: $to = "jason@jasonmilburn.com"($email_field); Quote Link to comment https://forums.phpfreaks.com/topic/67831-php-contact-form-auto-responder/#findComment-341084 Share on other sites More sharing options...
teng84 Posted September 4, 2007 Share Posted September 4, 2007 ignore... Quote Link to comment https://forums.phpfreaks.com/topic/67831-php-contact-form-auto-responder/#findComment-341087 Share on other sites More sharing options...
teng84 Posted September 4, 2007 Share Posted September 4, 2007 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; Quote Link to comment https://forums.phpfreaks.com/topic/67831-php-contact-form-auto-responder/#findComment-341088 Share on other sites More sharing options...
jasonmilburn Posted September 9, 2007 Author Share Posted September 9, 2007 Thanks! I tried it out and it still won't work. Any other ideas? I didn't try the REQUEST from idea above yet... Quote Link to comment https://forums.phpfreaks.com/topic/67831-php-contact-form-auto-responder/#findComment-344514 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.