- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:reference:recordset:getmenu3

# getMenu3

##### Syntax

    string getMenu3(
        optional string $selectName='',
        optional mixed $defaultValue=false,
        optional bool $blankFirstItem=true,
        optional bool $multiple=fale,
        optional int $numberOfRows=0,
        optional string $optionalAttributes='',
        )

## Description

The function `getMenu3()` Generates an HTML MULTI-SELECT tag string from a recordset, and return the string. The recordset requires 3 columns, the 3rd being used for the optgroup.

If a multiple option is not given, the function behaves exactly like `getMenu2()`.

## Parameters

### $selectName

name of SELECT tag

### $defaultValue

The value to highlight. Use an array for multiple highlight for listbox.

### $blankFirstLine

true to leave the 1st item in list empty

### $multiple

Set true to create a multi-select box

### $numberOfRows

Number of rows to show for multi-select box

### $optionalAttributes

Additional attributes to defined for SELECT tag, useful for holding javascript onChange='…' handlers.

### $compareAgainstFirstCol

When we have 2 cols in recordset, we compare the defstr with column 0 (1st col) if this is true.

## Usage

    /*
    * Connect to DB2 Sample Database
    */
    $SQL = "SELECT actdesc,actno,actgroup FROM act ORDER BY actgroup, actno
    $result = $db->execute($SQL);

    $html = $result->getMenu3('mySelect','30',true,true,10);

    print $html

    <select name="mySelect[]" multiple size="10" >
    <option></option>
    <optgroup label='ANALYSIS/DESIGN'>
    <option value='10'>MANAGE/ADVISE</option>
    <option value='20'>ESTIMATE COST</option>
    <option selected='selected' value='30'>DEFINE SPECS</option>
    <option value='40'>LEAD PROGRAM/DESIGN</option>
    <option value='50'>WRITE SPECS</option>
    <option value='60'>DESCRIBE LOGIC</option>
    </optgroup>
    <optgroup label='PROGRAM/TEST/INSTALL'>
    <option value='70'>CODE PROGRAMS</option>
    <option value='80'>TEST PROGRAMS</option>
    <option value='90'>ADM QUERY SYSTEM</option>
    </optgroup>
    <optgroup label='POST INSTALLATION'>
    <option value='100'>TEACH CLASSES</option>
    <option value='110'>DEVELOP COURSES</option>
    <option value='120'>PERS AND STAFFING</option>
    <option value='130'>OPER COMPUTER SYS</option>
    <option value='140'>MAINT SOFTWARE SYS</option>
    <option value='150'>ADM OPERATING SYS</option>
    <option value='160'>ADM DATA BASES</option>
    <option value='170'>ADM DATA COMM</option>
    <option value='180'>DOCUMENT</option>
    </optgroup>
    </select>

v5/reference/recordset/getmenu3.txt · Last modified: 2016/01/16 17:50 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top