kimeee Posted June 6, 2006 Share Posted June 6, 2006 I have set up a "Leave of Absence Request" form with HTML and PHP. When filled out and sent, it sends a copy to me.They (my superiors) have also asked if I can set it up so that when a user clicks on a radio button for a specific department, a separate email will be sent to that dept, as well as the email to me. I know this must be possible. I have tried many ways and have had no luck so far. Is there anyone out there that can help me? Quote Link to comment https://forums.phpfreaks.com/topic/11355-form-radio-button-values-emails/ Share on other sites More sharing options...
kenrbnsn Posted June 6, 2006 Share Posted June 6, 2006 Can you post the code your currently using? Quote Link to comment https://forums.phpfreaks.com/topic/11355-form-radio-button-values-emails/#findComment-42578 Share on other sites More sharing options...
nogray Posted June 6, 2006 Share Posted June 6, 2006 You can use a check box instead of the radio button like thisExample check box[code]<input type="checkbox" name="Department_name" value="Yes" /> Department Name[/code]in you php, you just need to add the extra email address to the "To"[code]$to = "your_email@domain.com";if ($_POST['Department_name'] == "Yes"){ $to .= ", department_email@domain.com";}[/code]Let me know if you need radio buttons and an example of your form if you need more help. Quote Link to comment https://forums.phpfreaks.com/topic/11355-form-radio-button-values-emails/#findComment-42588 Share on other sites More sharing options...
kimeee Posted June 8, 2006 Author Share Posted June 8, 2006 nogray: i need to set it up with 4 radio buttons with 4 different emails for each button. how would this work? with elseif? thanks![!--quoteo(post=380779:date=Jun 6 2006, 05:15 PM:name=nogray)--][div class=\'quotetop\']QUOTE(nogray @ Jun 6 2006, 05:15 PM) [snapback]380779[/snapback][/div][div class=\'quotemain\'][!--quotec--]You can use a check box instead of the radio button like thisExample check box[code]<input type="checkbox" name="Department_name" value="Yes" /> Department Name[/code]in you php, you just need to add the extra email address to the "To"[code]$to = "your_email@domain.com";if ($_POST['Department_name'] == "Yes"){ $to .= ", department_email@domain.com";}[/code]Let me know if you need radio buttons and an example of your form if you need more help.[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/11355-form-radio-button-values-emails/#findComment-43359 Share on other sites More sharing options...
nogray Posted June 8, 2006 Share Posted June 8, 2006 you can use something like this[code]<input type="radio" name="Email" value="Dep1" /> Dep1<input type="radio" name="Email" value="Dep2" /> Dep1<input type="radio" name="Email" value="Dep3" /> Dep1<input type="radio" name="Email" value="Dep4" /> Dep1[/code]and your php[code]$to = "your_email@domain.com";if ($_POST['Email'] == "Dep1"){ $to .= ", dept1_email@domain.com, dept1_email@domain.com, dept1_email@domain.com, dept1_email@domain.com";}else if ($_POST['Email'] == "Dep2"){ $to .= ", dept2_email@domain.com, dept2_email@domain.com, dept2_email@domain.com, dept2_email@domain.com";}else if ($_POST['Email'] == "Dep3"){ $to .= ", dept3_email@domain.com, dept3_email@domain.com, dept3_email@domain.com, dept3_email@domain.com";}else { $to .= ", dept4_email@domain.com, dept4_email@domain.com, dept4_email@domain.com, dept4_email@domain.com";}[/code]Hope this helps you. Quote Link to comment https://forums.phpfreaks.com/topic/11355-form-radio-button-values-emails/#findComment-43369 Share on other sites More sharing options...
.josh Posted June 8, 2006 Share Posted June 8, 2006 assuming that each department has the same domain for their email address..you don't need all those if statements. just pass the email name and add the @domain.com to the passed variable. Quote Link to comment https://forums.phpfreaks.com/topic/11355-form-radio-button-values-emails/#findComment-43372 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.