// loop through values and add them as options
if( is_array($field[‘choices’]) )
foreach( $field[‘choices’] as $key => $value )
if( $optgroup )
// this select is grouped with optgroup
if($key != ”) echo ‘<optgroup label=”‘.$key.'”>’;
Thanks for the code, bu i don’t quite understand what the issue is.
Can you please clarify the question?
What does and doesn’t work?
Where is your code found?
Is your code within an action?
Why is it broken into 2 parts which would cause PHP errors?
Why have you copied / pasted source code from the select field type?