I've only skimmed through, but I wanted to get my first question out here, seeing as I haven't found a specific and similar example/inquiry.
I have on the 'first page' of a site many groups of varying companies. In each group are 1 - 20 or so check-boxed input fields so that a client can require different information be sent to them after they submit the form below. On a separate page that only runs a php script, I email the form to the host company. The message then displays as so: (and I changed content...)
I want it to read:
*Favorite Animals: Dog, Cat, Bird*
However I have it reading:
Favorite Animals: Dog,
Favorite Animals: Cat,
Favorite Animals: Bird,
My Code:
On the first page we have a list of different checkboxes in the same array with obvious different values... like shown below:
<input type="checkbox" name="animals[]" value="Dogs" class="cb">
Dogs<br>
<input type="checkbox" name="animals[]" value="Cats" class="cb">
Cats<br>
<input type="checkbox" name="animals[]" value="Birds" class="cb">
Birds<br>
<input type="checkbox" name="animals[]" value="Dragons" class="cb">
Dragons<br>
The above code is then submitted (via post) to a separate php document.
The relevant code in this second page is:
$animals = $_POST['animals'];
below...
foreach ($animals as $an) {
$email_message .= "Favorite Animals: ".clean_string($an)." ,\n";
}
I realize what's going on, but I haven't figured out a way to work the foreach statement so that the "Favorite Animal's" is displayed once, followed by the possible array of whatever was selected on the previous page.
I have no errors, only getting the information in a way I don't desire. Any help would be appreciated!