not_vals in optionlist() is always true

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@147 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2007-07-11 22:25:54 +00:00
parent 65d2cc3637
commit 61fa06641f
6 changed files with 19 additions and 19 deletions

View File

@@ -12,15 +12,15 @@ function bracket_escape($idf, $back = false) {
return strtr($idf, ($back ? array_flip($trans) : $trans));
}
function optionlist($options, $selected = array(), $not_vals = false) {
function optionlist($options, $selected = array()) {
$return = "";
foreach ($options as $k => $v) {
if (is_array($v)) {
$return .= '<optgroup label="' . htmlspecialchars($k) . '">';
}
foreach ((is_array($v) ? $v : array($k => $v)) as $key => $val) {
$checked = in_array(($not_vals ? $val : $key), (array) $selected, true);
$return .= '<option' . ($not_vals ? '' : ' value="' . htmlspecialchars($key) . '"') . ($checked ? ' selected="selected"' : '') . '>' . htmlspecialchars($val) . '</option>';
$checked = in_array($val, (array) $selected, true);
$return .= '<option' . ($checked ? ' selected="selected"' : '') . '>' . htmlspecialchars($val) . '</option>';
}
if (is_array($v)) {
$return .= '</optgroup>';