tag and fixed SELECTED. Should be valid XHTML now // // parameters // ---------- // // name: the name attribute you want for the tag, i.e. // onChange="this.form.submit()" [optional] // // size: the SIZE attribute for the \n"; // list all the options while ( list( $value, $label ) = each( $values ) ) { $value2 = htmlspecialchars($value); $label2 = htmlspecialchars($label); // printed SELECTED if an item was previously selected // so we maintain the state if ($selected == $value) { $result .= "\n"; } else { $result .= "\n"; } } // finish the popup menu $result .= "\n"; echo $result; } } ?>