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
strict boolean No *FALSE* Will make the \"extra\" attributes *disabled* and *readonly* only be set, if they were supplied with either boolean *TRUE* or string *\"disabled\"* and *\"readonly\"* respectively
- 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.
<!---->
<?php
$smarty->assign('myOptions', array(
1800 => 'Joe Schmoe',
9904 => 'Jack Smith',
2003 => 'Charlie Brown')
);
$smarty->assign('mySelect', 9904);
?>
The following template will generate a drop-down list. Note the presence
of the `name` attribute which creates the `<select>` tags.