Page 1 of 1

Multiple Selections in E-mail?

Posted: Tue Nov 04, 2003 7:18 am
by Rewt
Here's the issue:
I've got a form that has multiple selections, and I need them to end up being emailed.

Right now, here's what I have:

Code: Select all

<form method="POST" action="<? echo"$PHP_SELF";?>">
<select size="4" name="selections&#1111;]" multiple>
 <option>Red</option>
 <option>Orange</option>
 <option>Yellow</option>
 <option>Green</option>
</select>
Now, when it's processed, it emails fine, however, all I get is 1 value for selections, regardless of how many are selected.

Any ideas?

Thanks in advance!
Rewt

Posted: Tue Nov 04, 2003 7:32 am
by qads
in emailing page, you need to have a loop in the code which reads all the values from the selections array.

here is a sample.

Code: Select all

<?php
for($x = 0; $x<=count($selections); $x++)
{
if(!empty($selections[$x]))
{
$values .= $selections[$x]."\n";
}
}
?>

So how would that end up in the mail() ?

Posted: Tue Nov 04, 2003 7:36 am
by Rewt
I see the stepping thru the array, and fully understand that.

However, how do I then plug that into the mail function?

Code: Select all

mail("user@email.com", "Web Form Submisison",
"selections&#1111;]", "From:$email");
Thanks for your help thus far... if I can just get it the rest of the way, I'll be set!

Lightbulb.

Posted: Tue Nov 04, 2003 9:44 am
by Rewt
Umm. Yeah.

So, instead of $selections[], I just put $values in.

Ahem.

Thank you.