Ok...I just found the method outlined in FAQ 31 and gave it a try in a simple form I named test, but I cant get it to work. Below is the code I used.
Form Code:
<div class="form_item">
<div class="form_item">
Select the recipient you wish to contact:<select name="recipients"> <option value="em1">Jasper</option> <option value="em2">Calhoun</option></select>
</div>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Subject</label>
<input class="cf_inputbox required" maxlength="150" size="30" title="Subject required" id="text_1" name="text_1" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 150px;">Message</label>
<textarea class="cf_inputbox required" rows="3" id="text_2" title="" cols="30" name="text_2"></textarea>
<a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" alt="" src="components/com_chronocontact/css/images/tooltip.png"/></a>
<div class="tooltipdiv">Message :: Message required</div>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_3" type="submit" /><input type="reset" name="reset" value="Reset"/>
</div>
<div class="cfclear"> </div>
</div>
On Submit code - before sending email:
<?php$emails_2 = array('em1'=>'example1@example.com', 'em2'=>'example2@example.com',);$MyForm =& CFChronoForm::getInstance('test');$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);$MyFormEmails->setEmailData(1, 'to', $emails_2[$_POST['recipients']]);?>
I used a Dynamic To field and gave it the value recipients.
When I submit the form, I get the following error, and it won't send any emails.
Parse error: syntax error, unexpected T_VARIABLE in /home/mysite/public_html/components/com_chronocontact/libraries/customcode.php(64) : eval()'d code on line 1
Any help would be appreciated.