If you create a collection of checkboxes all named "email" and set the value to the email address:
<input type="checkbox" name="email[]" value="dept1@dmain.com" id="email_0" />
<input type="checkbox" name="email[]" value="dept2@domain.com" id="email_1" />
<input type="checkbox" name="email[]" value="dept3@dmain.com" id="email_2" />
<input type="checkbox" name="email[]" value="dept4@domain.com" id="email_3" />
You can set the top address to use the email form element and implode() the array to a comma separated list:
<?php echo ((isset($_POST["email"]))?implode(", ",$_POST["email"]):""); ?>
Forget all my other posts after the one from Jason. I now realise I have just been confusing myself!
I understand what Jason has suggested, but from what I understand each checkbox would have one email address. What I am looking for is for each checkbox value to hold all email addresses for that department which is retrieved from my database.
Would I just put some sort of while statement in each value? I have tried to research arrays to see if that would help and I think that is what has gotten me so confused.