[thelist] HTML/PHP Form Question - Sending Multiple Selections of a dropdown
P Chen
info at designbychen.com
Mon Apr 6 19:10:18 CDT 2009
Thanks Anthony, this works well. I spent almost a whole day searching Google
and all I got was flustered, so perhaps I could edit...Google is your
friend, but theList subscribers are supreme.
Very grateful,
-Peter
-----Original Message-----
From: Anthony Baratta [mailto:anthony at baratta.com]
Sent: Saturday, April 04, 2009 2:46 PM
To: info at designbychen.com; thelist at lists.evolt.org
Subject: Re: [thelist] HTML/PHP Form Question - Sending Multiple Selections
of a dropdown
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
>
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.11.42/2042 - Release Date: 04/05/09
10:54:00
More information about the thelist
mailing list