title: php foreach checkbox checked add to $emailto
body: <p>My form needs to have multiple email addresses. I have a form that has checkboxes. Every checkbox that is checked should be added to where the emails' recepient list. The data is getting passed correctly, I know this because if I echo it out on a new page it will correctly show each of the values. I'm using <code>$_POST</code>.  </p>
  
  <p>The variable to append is called <code>$email_to</code>.<br>
  It gets sent in: <code>@mail($email_to, $email_subject, $email_message, $headers);</code>  </p>
  
  <p>With a static <code>$email_to</code> value the form functions properly and emails the data.</p>
  
  <p>So far I've tried<br>
   <code>foreach($_POST['rep'] as $rep_num) { $emailto = $rep_num;}</code><br>
   <code>foreach($_POST['rep'] as $rep_num[]) { $emailto = $rep_num[];}</code> </p>
  
  <p>I think the foreach is lacking something, but I can't figure out what. It can echo it out fine, but not store it in a variable. Can anyone point me in the direction of what I need to?</p>
  
  <p><strong>HTML</strong>  </p>
  
  <pre><code>&lt;div class="clearfix email_boxes"&gt;
          &lt;input type="checkbox" name="rep[]" value="02@address.com,"&gt;Lorem Ipsum 01
          &lt;input type="checkbox" name="rep[]" value="02@address.com,"&gt;Lorem Ipsum 02
          &lt;input type="checkbox" name="rep[]" value="03@address.com,"&gt;Lorem Ipsum 03
  &lt;/div&gt;
  </code></pre>