# Foreach $\_POST Form Mailer

**URL:** https://forum.kirupa.com/t/foreach--post-form-mailer/301280
**Category:** Uncategorized
**Created:** [December 6, 2009, 8:27pm UTC](https://forum.kirupa.com/t/foreach--post-form-mailer/301280 "2009-12-06T20:27:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![drummer392](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@drummer392](https://forum.kirupa.com/u/drummer392)
#### Post date: [December 6, 2009, 8:27pm UTC](https://forum.kirupa.com/t/foreach--post-form-mailer/301280/1 "2009-12-06T20:27:00Z")

</div>

Hello there,

This is probably a really simple fix, but I have been trying to figure this one out for a good while before posting it here.

Okay, so I have a form with elements that post into a form\_mailer.php page. So far everything works using the foreach function below:

```php

foreach($_POST as $name => $value) {
print "$name : $value<br>";
}

```

Now I need to put every element called $body.

For example: Say I have 3 elements on the previous page that post into this page. These elements are: El\_1, El\_2, El\_3. So when the foreach scans through the form, I want it to put the elements in $body variable like so: $body= “el\_1, el\_2, el3”;

What I am thinking needs to happen is that every form element gets its own variable name.

Any suggestions?

Thanks,  
Brandon
