====== getMenu3 ====== ~~NOTOC~~ This method requires that ADODB_FETCH_MODE be set to ADODB_FETCH_NUM prior to execution of the SQL statement that will provide the recordset. == See Also == [[v5:reference:recordset:getmenu|getMenu()]]\\ [[v5:reference:recordset:getmenu2|getMenu2()]]\\ == Syntax == string getMenu3( optional string $selectName='', optional mixed $defaultValue=false, optional mixed $blankFirstItem=true, optional bool $multiple=false, optional int $numberOfRows=0, optional string $optionalAttributes='' ) ===== Description ===== The function ''getMenu3()'' Generates an HTML OPTGROUP select string from a recordset, and returns the string. The recordset requires 3 columns, the 3rd being used for the optgroup. The select can be defined as either a single or multiple select. In order for the optgroup to work correctly, the SQL statement used must be ORDERED by some order that begins with the 3rd column in the SELECT. If more than 3 columns are returned, the 4th and greater columns are discarded. ===== Parameters ===== ==== $selectName ===== name of SELECT tag ==== $defaultValue ==== The value to highlight. Use either a string for a single value to match, or a numeric array if a multiselect box is going to be built and there are multiple matching defaults. ==== $blankFirstLine ==== This parameter has the following available options: * true (default) - creates an empty '''' tag * false - does not creates an empty '''' tag * string value - creates an '''' tag * string value format ''value:description'' - creates an '''' tag ==== $multiple ==== Set true to create a multi-select box ==== $numberOfRows ==== Number of rows to show for multi-select box. If not a multi-select, this field has no meaning. ==== $optionalAttributes ==== Additional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers or class information. Note that by default, the select box is generated without an id, so this should be included here. ===== Usage ===== /* * Connect to DB2 Sample Database */ $db->setFetchMode(ADODB_FETCH_NUM); $SQL = "SELECT actdesc,actno,actgroup FROM act ORDER BY actgroup, actno $result = $db->execute($SQL); $html = $result->getMenu3('mySelect', array('30','40','50'), true, true, 10, 'id="mySelect" class="myclass-1 myclass-2"); print $html