[thelist] HTML/PHP Form Question - Sending Multiple Selections of a dropdown

P Chen info at designbychen.com
Sat Apr 4 01:32:52 CDT 2009

I'm on the edge of my knowledge about PHP and could really use some help.

I tweaked a form (PHPFormGenerator at sourceforge) to accept multiple
selections on a dropdown by adding the 'multiple' attribute. My problem is
that I don't know how to tweak the PHP to send (email) all of the selected
values. After much googling, I'm thinking that I need to write some php to
'implode' the array (below--try not to laugh), but I'm unsure how to include
something like that within the mail function of the processor script.

$locs = array("field_1"); 
echo implode(",",$locs); . "

The HTML of the select tag is: <select name="field_1[]" multiple>

The stripped down PHP email processor script I'm working with is:

if( ($_SESSION['security_code']==$_POST['security_code']) ) { 
mail("me at email.com","MyForm","FormData: 
Which location(s)?: " . $_POST['field_1'] . " 

Any and all help is greatly appreciated. 

Thanks much,

More information about the thelist mailing list