johnmark Posted August 14, 2007 Share Posted August 14, 2007 Hello, I want to create a drop down list that has multiple emails in it, that when one is selected, after the form is filled out it will be sent to that email. I have searched around but haven't found the solution. I can see it in my head just can't get it out. If you could give me a link that applies to this, or even an easy code... I would be very grateful. Thank You for the help. John Quote Link to comment https://forums.phpfreaks.com/topic/64826-solved-drop-down-email-sending/ Share on other sites More sharing options...
PhaZZed Posted August 14, 2007 Share Posted August 14, 2007 email form: <form action="send.php" method="post"> <select name="emailto"> <option value="chris@place.com">Chris</option> <option value="sean@place.com">Sean</option> </select> </form> PHP send code: <? $mailfrom = "from@address.co.za"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: $mailfrom\r\n"; $msg = "Hello World"; $recipient .= $_POST['emailto']; $subject = "Subject"; mail($recipient, $subject, $msg, $headers); echo "Your mail has been successfully sent."; ?> Enjoy Quote Link to comment https://forums.phpfreaks.com/topic/64826-solved-drop-down-email-sending/#findComment-323407 Share on other sites More sharing options...
HuggieBear Posted August 14, 2007 Share Posted August 14, 2007 This is open to spam as you're coding the email addresses in the page. Crawlers will have a field day. Think about using a name => id type link. Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/64826-solved-drop-down-email-sending/#findComment-323492 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.