wiredweb Posted June 26, 2006 Share Posted June 26, 2006 I am making a prescription refill form for a local vet clinic and there is a drop down menu to choose where the from will be sent but I never recieve the emails of the completed forms. I have tried several different things but nothing works. The form will work with a single email address though.Here is the code. The form is at [a href=\"http://twinforksclinic.com/prescription.php\" target=\"_blank\"]http://twinforksclinic.com/prescription.php[/a].<?php$subject = "Prescription Refill for Twin Forks";$clinic = $_REQUEST['clinic'];$owner = $_REQUEST['owner'] ;$owneremail = $_REQUEST['owneremail'];$pet = $_REQUEST['pet'] ;$weight = $_REQUEST['weight'] ;$phone = $_REQUEST['phone'] ;$qty1 = $_REQUEST["qty1"];$heartworm = $_REQUEST['heartworm'];$qty2 = $_REQUEST["qty2"];$fleatick = $_REQUEST['fleatick'];$qty3 = $_REQUEST["qty3"];$revolution = $_REQUEST['revolution'];$message = $_REQUEST['message']; if($clinic == "Benkelman")$email = "email@twinforksclinic.com";if($clinic == "Wray")$email = "email2@twinforksclinic.com";$message = "Sent From: $ownerOwner Email: $owneremailClinic: $clinicPet's Name: $petPet's Weight: $weightOwner's Phone: $phoneHeatworm Qty: $qty1Heartworm: $heartwormFlea/Ticky Qty: $qty2K9: $fleatickRevolution Qty: $qty3Revolution: $revolution Speacial Instructions: $message";mail( $clinic, $subject, $message, "From: $email" );header( "Location: [a href=\"http://www.twinforksclinic.com/thankyou.php"\" target=\"_blank\"]http://www.twinforksclinic.com/thankyou.php"[/a] );?>Thanks for your help in advance! Quote Link to comment https://forums.phpfreaks.com/topic/12958-php-form-help/ Share on other sites More sharing options...
.josh Posted June 26, 2006 Share Posted June 26, 2006 cuz you aren't sending the email to an email address. $clinic seems to be the name of the clinic, and you are putting the name of the clinic into the "To:" arguement of the mail functionmail( [b]$clinic[/b], $subject, $message, "From: $email" ); Quote Link to comment https://forums.phpfreaks.com/topic/12958-php-form-help/#findComment-49809 Share on other sites More sharing options...
wiredweb Posted June 26, 2006 Author Share Posted June 26, 2006 Thats because $clinic is a drop down menu that goes to this:if($clinic == "Benkelman")$email = "email@twinforksclinic.com";if($clinic == "Wray")$email = "email2@twinforksclinic.com";How else can I do it so you can choose which email address it goes to? Quote Link to comment https://forums.phpfreaks.com/topic/12958-php-form-help/#findComment-49818 Share on other sites More sharing options...
AndyB Posted June 26, 2006 Share Posted June 26, 2006 [code]if($clinic == "Benkelman")$to_email = "email@twinforksclinic.com";if($clinic == "Wray")$to_email = "email2@twinforksclinic.com";... more code ...mail( $to_email, $subject, $message, "From: $email" );[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12958-php-form-help/#findComment-49835 Share on other sites More sharing options...
wiredweb Posted June 26, 2006 Author Share Posted June 26, 2006 Thank you so much for your help. The script now works!!!! Quote Link to comment https://forums.phpfreaks.com/topic/12958-php-form-help/#findComment-49858 Share on other sites More sharing options...
timmah22 Posted June 26, 2006 Share Posted June 26, 2006 or you could do it the right way so you dont have to update your both php code and html everytime you add an email address.add a value to your option<select name="clinic" id="clinic"> <option value="timmah@timmah.com">Benkelman</option> <option value="timmah2@timmah.com">Wray</option> </select> Quote Link to comment https://forums.phpfreaks.com/topic/12958-php-form-help/#findComment-49865 Share on other sites More sharing options...
AndyB Posted June 26, 2006 Share Posted June 26, 2006 [!--quoteo(post=388274:date=Jun 26 2006, 07:46 PM:name=timmah22)--][div class=\'quotetop\']QUOTE(timmah22 @ Jun 26 2006, 07:46 PM) [snapback]388274[/snapback][/div][div class=\'quotemain\'][!--quotec--]or you could do it the right way... [/quote]The obvious disadvantage to that is it exposes all the email addresses to email address searching bots. Helloooo SPAM. Quote Link to comment https://forums.phpfreaks.com/topic/12958-php-form-help/#findComment-49870 Share on other sites More sharing options...
wiredweb Posted June 27, 2006 Author Share Posted June 27, 2006 There are only 2 clinics so I wont need to update the emails. Quote Link to comment https://forums.phpfreaks.com/topic/12958-php-form-help/#findComment-49916 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.