{html_options} is a
custom function
that creates the html <select><option> group
with the assigned data. It takes care of which item(s) are selected by
default as well.
Attribute Name
Type
Required
Default
Description
values
array
Yes, unless using options attribute
n/a
An array of values for dropdown
output
array
Yes, unless using options attribute
n/a
An array of output for dropdown
selected
string/array
No
empty
The selected option element(s)
options
associative array
Yes, unless using values and output
n/a
An associative array of values and output
name
string
No
empty
Name of select group
Required attributes are
values and output,
unless you use the combined options instead.
If the optional name attribute is given, the
<select></select> tags are created,
otherwise ONLY the <option> list is generated.
If a given value is an array, it will treat it as an html
<optgroup>, and display the groups.
Recursion is supported with <optgroup>.
All parameters that are not in the list above are printed as name/value-pairs
inside the <select> tag. They are ignored if
the optional name is not given.
All output is XHTML compliant.
Example 8-12. Associative array with the options attribute