thumbless Posted August 6, 2008 Share Posted August 6, 2008 It may be helpful to look at this page first: www.fourseasonsbowl.net/contact.htm When clicking on the radio buttons I would like to define two different email address so the email would go to who they selected is this even possible I will include the code I have so far below. By the way the code I have so far was from a tutorial. Who would you like to contact: o Office o Webmaster <?php /* Subject & Email Variables */ $emailSubject = 'Four Seasons Bowl'; $webMaster = '[email protected]'; /* Gathering Dada Variable */ $emailField = $_POST['email']; $nameField = $_POST['name']; $phoneField = $_POST['phone']; $comentsField = $_POST['coments']; $body = <<<EOD <br><hr><br> Email: $email <br> Name: $name <br> Phone Number: $phone <br> Coments: $coments <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emaiSubject, $body, $headers); /* Result Rendered as HTML */ $theResults = <<<EOD <html> <head> <title>JakesWorks - travel made easy-Homepage</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } --> </style> </head> <div> <div align="left">Thank you for your interest! Your email will be answered very soon!</div> </div> </body> </html> EOD; echo "$theResults"; ?> Link to comment https://forums.phpfreaks.com/topic/118381-question-on-creating-contact-form/ Share on other sites More sharing options...
jjmusicpro Posted August 6, 2008 Share Posted August 6, 2008 You could add 2 email vars, then do a quick if else, to see what one is selected. Link to comment https://forums.phpfreaks.com/topic/118381-question-on-creating-contact-form/#findComment-609251 Share on other sites More sharing options...
DamienRoche Posted August 6, 2008 Share Posted August 6, 2008 This is simple....for once Create the radio button and assign it a 'name' and 'value' (email address): <input type="radio" name="mailwho" value="[email protected]" /> <input type="radio" name="mailwho" value="[email protected]" /> then in your php file call the value and put it in a variable: $mailwho = $_POST['mailwho']; then use the variable ($mailwho) as the 'to' address: $to = "$mailwho"; mail ($to ....blahblah blah); I may have missed something, tweak it as you see fit. You'll get the hang of it in no time. Link to comment https://forums.phpfreaks.com/topic/118381-question-on-creating-contact-form/#findComment-609260 Share on other sites More sharing options...
thumbless Posted August 6, 2008 Author Share Posted August 6, 2008 Can you tell me where in each of these lines I would place the code? Once I have it in place I can tweek it from there. Thanks for the quick replys. Link to comment https://forums.phpfreaks.com/topic/118381-question-on-creating-contact-form/#findComment-609597 Share on other sites More sharing options...
thumbless Posted August 30, 2008 Author Share Posted August 30, 2008 Can anyone help me out with this? Link to comment https://forums.phpfreaks.com/topic/118381-question-on-creating-contact-form/#findComment-629490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.