jimmy3384 Posted September 30, 2011 Share Posted September 30, 2011 I am trying to create or form or even see if it is possible to have an html form where you have multiple check boxes and based on the selection of the check boxes it will send an email to different addresses.... Example: Checkbox 1 - person1@test.comCheckbox 2 - person2@test.comCheckbox 3 - person3@test.com Lets say I check box 1 and 3 on the form and I want an email created when I hit the submit button to have person 1's and person 3's email address in the TO field. Is this possible at all or does it even make sense? Thank you for taking the time to look at this. Link to comment Share on other sites More sharing options...
ShadowMage Posted September 30, 2011 Share Posted September 30, 2011 Certainly possible. You would just set up your inputs to submit as an array: <input type='checkbox' name='email[]' value='person1' /><input type='checkbox' name='email[]' value='person2' /><input type='checkbox' name='email[]' value='person3' /> The [] make it into an array that you can loop through on the server. Something like: $strRecipients = '';for ($x=0, $x<count($_POST['email']); $x++) { if ($strRecipients != '') $strRecipients.='; '; $strRecipients .= $_POST['email'][$x].'@test.com';} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.