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

Anthony Baratta anthony at baratta.com
Sat Apr 4 16:45:54 CDT 2009


Google is your friend. :-)

http://www.google.com/search?hl=en&q=php+select+multiple&btnG=Google+Search&aq=1&oq=php+select+

join(",",$_POST["test"])

Your code: Which location(s)?: " . $_POST['field_1'] . "

Should be: Which location(s)?: " . join(",",$_POST['field_1']) . "


P Chen wrote:
> 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:
> 
> <?php 
> session_start(); 
> 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,
> Peter
> 




More information about the thelist mailing list