View Full Version : help with form

05-14-2008, 07:26 PM
i am working on an order form for a friend and need to know where to enter an array in the php code. here is the php...

foreach ($_POST as $key => $value) {
$key = clear_user_input($key);
$value = clear_user_input($value);
if ($key=='extras') {

if (is_array($_POST['magnetic thoughts']) ){
$body .= "$key: ";
$counter =1;
foreach ($_POST['magnetic thoughts'] as $value) {
//Add comma and space until last element
if (sizeof($_POST['magnetic thoughts']) == $counter) {
$body .= "$value\n";
else {
$body .= "$value, ";
$counter += 1;
} else {
$body .= "$key: $value\n";
} else {

$body .= "$key: $value\n";

I have my html like this.....

<p class="legend">magnetic thoughts @ 3.95 each</p>
<fieldset id="choices">
<p id="magnetic thoughts">
<input type="checkbox" name="magnetic thoughts[]" value="ma01" />ma01
<input type="checkbox" name="magnetic thoughts[]" value="ma02" />ma02


there are many other items but noone needs to see all of that.

any help is appreciated.

05-14-2008, 07:47 PM
The space could be a problem with the naming so use a underscore.

05-14-2008, 09:57 PM
ok, did that and inserted a new script that works wonderfully when the user completes their order. My problem is that the order that comes to my email just says....after listing name and address and all the other info......magnetic_thoughts: Array. so it doesn't give the individual names of the products that have been ordered.
any thoughts on how to fix this?