Jump to content

Form - Check Boxes - Sending To Different Addresses

Recommended Posts

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 post
Share on other sites

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...