# Foreach problems

**URL:** https://forum.kirupa.com/t/foreach-problems/291488
**Category:** Uncategorized
**Created:** [June 30, 2009, 1:25pm UTC](https://forum.kirupa.com/t/foreach-problems/291488 "2009-06-30T13:25:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gilbertsavier](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@gilbertsavier](https://forum.kirupa.com/u/gilbertsavier)
#### Post date: [June 30, 2009, 1:25pm UTC](https://forum.kirupa.com/t/foreach-problems/291488/1 "2009-06-30T13:25:27Z")

</div>

Hi,  
I have a list of names, emails, a checkbox and a message box, the names and emails are from a database. What I am trying to do to select say 5 of the names from the list via the checkbox and send an email to those who I have picked.

I can’t seem to get my head around the foreach function, is it that there has to be a foreach function to collect the email addresses and to see which user has been selected or do they come under the same one.

I have tried to do some of the coding myself, but fear I am getting more and more confused, some help would be great. Here is what I have done so far.

Thanks
