osCommerce/oscommerce2 — pull request #15 by randomecho (2012-03-18 19:48:27+00:00)
Title: Allow form pulldown to pre-select multiple values if array is passed containing desired defaults

In cases where the store may want or need to show multiple options in a SELECT form input item, this will allow an array of default values to be passed and pre-selected.

Example:

$comic_publishers[] = array("id" => 'marvel', "text" => 'Marvel');
$comic_publishers[] = array("id" => 'dc', "text" => 'DC');
$comic_publishers[] = array("id" => 'darkhorse', "text" => 'Dark Horse');
$comic_publishers[] = array("id" => 'image', "text" => 'Image Comics');
$comic_publishers[] = array("id" => 'idw', "text" => 'IDW');

$fave_publishers = array('marvel', 'darkhorse', 'image');

echo tep_draw_pull_down_menu('house_of_comics', $comic_publishers, $fave_publishers, 'size="5" multiple');

The above will show a SELECT input field of multiple options, five items showing before scrolling, where "Marvel", "Dark Horse" and "Image Comics" will be already selected.