Select Multiple on Form Dropdown

I need some assistance changing a single select into a multiple select form drop-down. I am having issues with the multiple selections storing. Thank you for your help!

[php]$var = "

            <script type='text/javascript'>



                     jQuery('form').attr('method', 'get');

                     jQuery('form').after('<input type=\"submit\"  id=\"doaction_k2\" class=\"button-secondary action\" value=\"Apply Folder Access\" style=\"background: red; color: #fff;\">');



                var thisurl = '';

                var thaturl = '';

                jQuery('#doaction_k2').live('click', function(){


                        thisurl = thisurl + '|' + jQuery(this).attr('userid') + '~' + jQuery(this).val();




                        thaturl = thaturl + '|' + jQuery(this).attr('userid') + '~' + jQuery(this).val();



          , { update_access: 1, file_access: thisurl, file_readwrite: thaturl }, function(){

                        window.location = document.URL;



                    return false;







            $var .= "<select multiple='yes' id='file_manager_accessk".$user_id."[]' class='new_file_access' userid='$user_id'><option value='' $noaccess>No Access</option>";
            foreach($ACCESS_ARRAY as $key=>$value)


                    $key = str_replace('\\', '/', $key);

                    $keys = $key .'~'. $urls.'/'.$value;

                    $keys = substr($keys, 0, strlen($keys)-1);

                    $keys1 = base64_encode($keys);


                    $var .= "<option value='$keys1' $select[$keys]>$value</option>";


            $var .= "</select>";

            return $var;[/php]

Can you share the HTML Output from you code?

on your select tag add the attribute “multiple” like so…

<select name='multipleOptions'> multiple

When accessing it with php it will be an array. Just do a print_r on that input and you will see how it is stored.

#1 multiple needs to be inside the tag
#2 you must define the name as an array with []


You are absolutely correct, those where really poor mistakes.

Sponsor our Newsletter | Privacy Policy | Terms of Service