[FX.php List] Multi Selection Posting

Andrew Denman adenman at tmea.org
Tue Apr 25 09:16:53 MDT 2006


I have just done a lot of study on checkboxes that I was going to post to
the list, and apparently multi-select boxes work the same way.

 

Until I finish my complete write-up, here's the quick version: for
multi-selectable checkboxes and multi-select lists processed using PHP, you
need to add [] to the 'name' element.  (ie: name="CopyTo[]")  This will tell
PHP there are possible multiple values and it will create an array in the
$_POST/$_GET/$_REQUEST variable for that field.

 

Andrew Denman

  _____  

From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of
gerry.charest at agfa.com
Sent: Tuesday, April 25, 2006 9:58 AM
To: FX.php Discussion List
Subject: Re: [FX.php List] Multi Selection Posting

 

I have a form that allows for the selection of multiple items from a list.
Upon reviewing the entries in the database I see that I am only getting the
first item selected. Further reviewing the POST value for the field in
question I see that only one value was received. Is there something missing,
do I need to do something special to send and post multiple selection?

Here is the form field for the value list posting.

<select name="CopyTo" size="3" multiple>
<option value=""></option>
<?php 
foreach ($searchUserResult['data'] as $key => $searchUserData){
echo '"<option
value="'.$searchUserData['NameFullLastFirst'][0].'">'.$searchUserData['NameF
ullLastFirst'][0].'</option>"';
}
?>
</select>


Best Regards

Gerry Charest
Agfa Corporation

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20060425/b4a41903/attachment.html


More information about the FX.php_List mailing list