Foreach problems

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.