hi there, I have been battling this one for a while and keep thinking Im on the verge of solving it but continually let down by my mediocre cut and paste PHP “skills”…
in summary I have a form which has a group of checkboxes showing email addresses, and a list field below which allows the user to add up to 10 more email addresses. I have a custom PHP function running which currently takes the addresses from the list field and inserts them into the BCC field of an email which successfully is sent out.
what I am now trying to do is also add the checked email addresses from the checkbox group to the BCC field, so the email is sent out to the list of recipients made from the combined output of the checkbox and list field.
currently the code is as follows:
$emails = $entry[1]; //field 1 is the list field
$emailRecipients = unserialize($emails);
$notification['bcc'] = implode(",", $emailRecipients);
I have tried a few different methods of extracting checked values from the checkbox field (field #4) and combining it into an array with field #1 but I think the issue is arising in not having the data formatted correctly. eg one attempt had
$emails1 = $entry[1]; //list field
$emails2 = $entry[4]; //checkbox field
$emailRecipients = merge_array($emails1,$emails2);
then I discovered that the list field output is a different array structure than the checkbox array so I attempted a few methods of serializing and unserializing but still cant combine them. I feel like it should be simple so can anyone set me straight? Much appreciated!