After reading FAQ31 and related postings in the forum, I still cannot figure out how to modify the code in FAQ31 to get this work.
Let say in the form I have
The code in FAQ31 to enter in 'On Submit code - before sending email' field is:
Now the question is how should I modify the code above so that it works for multiple recipients based on checkboxes. I'm using ChronoForms v3.1
Let say in the form I have
<input value="em1" type="checkbox" name="check[]" />
<label for="check1"">Sample 1</label>
<input value="em2" type="checkbox" name="check[]" />
<label for="check2">Sample 2</label>
<input value="em3" type="checkbox" name="check[]" />
<label for="check3">Sample 3</label>
The code in FAQ31 to enter in 'On Submit code - before sending email' field is:
<?php
$emails_2 = array('em1'=>'sample1@email.com', 'em2'=>'sample2@email.com', 'em3'=>'name_3@example.com', . . .);
$MyForm =& CFChronoForm::getInstance('form_name_here');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$MyFormEmails->setEmailData(1, 'to', $emails_2[$_POST['recipients']]);
?>
Now the question is how should I modify the code above so that it works for multiple recipients based on checkboxes. I'm using ChronoForms v3.1