]> git.joonet.de Git - adminer.git/commitdiff
Utilize html_select
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 2 Oct 2009 13:21:34 +0000 (13:21 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 2 Oct 2009 13:21:34 +0000 (13:21 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1162 7c3ca157-0c34-0410-bff1-cbf682f78f5c

13 files changed:
adminer/create.inc.php
adminer/database.inc.php
adminer/db.inc.php
adminer/dump.inc.php
adminer/event.inc.php
adminer/foreign.inc.php
adminer/include/adminer.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/include/lang.inc.php
adminer/indexes.inc.php
adminer/trigger.inc.php
editor/include/adminer.inc.php

index 28bef2ca16cb9833a3cecfc28045d40ee66b1a62..5ff58c7e8952c3176c991a2de0442423c364c6d6 100644 (file)
@@ -155,8 +155,8 @@ foreach ($engines as $engine) {
 <form action="" method="post" id="form">
 <p>
 <?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>">
-<select name="Engine"><option value="">(<?php echo lang('engine'); ?>)<?php echo optionlist($engines, $row["Engine"]); ?></select>
-<select name="Collation"><option value="">(<?php echo lang('collation'); ?>)<?php echo optionlist($collations, $row["Collation"]); ?></select>
+<?php echo html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]); ?>
+<?php echo html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]); ?>
 <input type="submit" value="<?php echo lang('Save'); ?>">
 </p>
 <table cellspacing="0" id="edit-fields">
@@ -178,7 +178,7 @@ if ($connection->server_info >= 5.1) {
        ?>
 <fieldset><legend><?php echo lang('Partition by'); ?></legend>
 <p>
-<select name="partition_by" onchange="partition_by_change(this);"><option><?php echo optionlist($partition_by, $row["partition_by"]); ?></select>
+<?php echo html_select("partition_by", array(-1 => "") + $partition_by, $row["partition_by"], "partition_by_change(this);"); ?>
 (<input name="partition" value="<?php echo h($row["partition"]); ?>">)
 <?php echo lang('Partitions'); ?>: <input name="partitions" size="2" value="<?php echo h($row["partitions"]); ?>"<?php echo ($partition_table || !$row["partition_by"] ? " class='hidden'" : ""); ?>>
 <table cellspacing="0" id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>>
index ba10677265a64d2306ccc6c89a459e0f5993fa01..f0d36679e5c0121b7e49d9d443565ecf270cf549 100644 (file)
@@ -72,7 +72,7 @@ if ($_POST) {
        ? '<textarea name="name" rows="10" cols="40">' . h($name) . '</textarea><br>'
        : '<input name="name" value="' . h($name) . '" maxlength="64">'
 ) . "\n"; ?>
-<select name="collation"><option value="">(<?php echo lang('collation'); ?>)<?php echo optionlist($collations, $collate); ?></select>
+<?php echo html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $collate); ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
index 7b8fd599353392eef1b61a1b04a405d2d2429e7b..39bd12770a8f9e9f140128c04485261514017585 100644 (file)
@@ -68,7 +68,7 @@ if (!$table_status) {
        $dbs = get_databases();
        if (count($dbs) != 1) {
                $db = (isset($_POST["target"]) ? $_POST["target"] : DB);
-               echo "<p>" . lang('Move to other database') . ($dbs ? ": <select name='target'>" . optionlist($dbs, $db) . "</select>" : ': <input name="target" value="' . h($db) . '">') . " <input type='submit' name='move' value='" . lang('Move') . "'>\n";
+               echo "<p>" . lang('Move to other database') . ($dbs ? ": " . html_select("target", $dbs, $db) : ': <input name="target" value="' . h($db) . '">') . " <input type='submit' name='move' value='" . lang('Move') . "'>\n";
        }
        echo "</form>\n";
 }
index 8e3e8ccaa71eaa161654e6e43f2c80625684912d..7bc6c30ad3a2e8a424bd5063006b51fcaddee3dc 100644 (file)
@@ -144,16 +144,16 @@ if ($connection->server_info >= 5) {
 }
 echo "<tr><th>" . lang('Output') . "<td><input type='hidden' name='token' value='$token'>" . $adminer->dumpOutput(0) . "\n"; // token is not needed but checked in bootstrap for all POST data
 echo "<tr><th>" . lang('Format') . "<td>" . $adminer->dumpFormat(0) . "\n";
-echo "<tr><th>" . lang('Database') . "<td><select name='db_style'>" . optionlist($db_style, (strlen(DB) ? '' : 'CREATE')) . "</select>\n";
+echo "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, (strlen(DB) ? '' : 'CREATE'));
 if ($connection->server_info >= 5) {
        $checked = strlen($_GET["dump"]);
-       checkbox("routines", 1, $checked, lang('Routines'));
+       echo checkbox("routines", 1, $checked, lang('Routines'));
        if ($connection->server_info >= 5.1) {
-               checkbox("events", 1, $checked, lang('Events'));
+               echo checkbox("events", 1, $checked, lang('Events'));
        }
 }
-echo "<tr><th>" . lang('Tables') . "<td><select name='table_style'>" . optionlist($table_style, 'DROP+CREATE') . "</select>\n";
-echo "<tr><th>" . lang('Data') . "<td><select name='data_style'>" . optionlist($data_style, 'INSERT') . "</select>\n";
+echo "<tr><th>" . lang('Tables') . "<td>" . html_select('table_style', $table_style, 'DROP+CREATE');
+echo "<tr><th>" . lang('Data') . "<td>" . html_select('data_style', $data_style, 'INSERT');
 ?>
 </table>
 <p><input type="submit" value="<?php echo lang('Export'); ?>"></p>
index 4a35f804c39c1243c48f2b3b2ac25ee2d25c532a..52d15f1737fd6535ed458596586ad6963ce55bee 100644 (file)
@@ -40,8 +40,8 @@ if ($_POST) {
 <tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" maxlength="64">
 <tr><th><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>">
 <tr><th><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>">
-<tr><th><?php echo lang('Every'); ?><td><input name="INTERVAL_VALUE" value="<?php echo h($row["INTERVAL_VALUE"]); ?>" size="6"> <select name="INTERVAL_FIELD"><?php echo optionlist($intervals, $row["INTERVAL_FIELD"]); ?></select>
-<tr><th><?php echo lang('Status'); ?><td><select name="STATUS"><?php echo optionlist($statuses, $row["STATUS"]); ?></select>
+<tr><th><?php echo lang('Every'); ?><td><input name="INTERVAL_VALUE" value="<?php echo h($row["INTERVAL_VALUE"]); ?>" size="6"> <?php echo html_select("INTERVAL_FIELD", $intervals, $row["INTERVAL_FIELD"]); ?>
+<tr><th><?php echo lang('Status'); ?><td><?php echo html_select("STATUS", $statuses, $row["STATUS"]); ?>
 <tr><th><?php echo lang('Comment'); ?><td><input name="EVENT_COMMENT" value="<?php echo h($row["EVENT_COMMENT"]); ?>" maxlength="64">
 <tr><th>&nbsp;<td><?php echo checkbox("ON_COMPLETION", "PRESERVE", $row["ON_COMPLETION"] == "PRESERVE", lang('On completion preserve')); ?>
 </table>
index a0b54ea6ded2699988c102caa697d31c11a2e38d..f3c54538087f4f5740cc97df184965be678ecbfc 100644 (file)
@@ -44,7 +44,7 @@ $target = ($TABLE === $row["table"] ? $source : get_vals("SHOW COLUMNS FROM " .
 <form action="" method="post">
 <p>
 <?php echo lang('Target table'); ?>:
-<select name="table" onchange="this.form['change-js'].value = '1'; this.form.submit();"><?php echo optionlist(array_keys(table_status_referencable()), $row["table"]); ?></select>
+<?php echo html_select("table", array_keys(table_status_referencable()), $row["table"], "this.form['change-js'].value = '1'; this.form.submit();"); ?>
 <input type="hidden" name="change-js" value="">
 </p>
 <noscript><p><input type="submit" name="change" value="<?php echo lang('Change'); ?>"></noscript>
@@ -54,15 +54,15 @@ $target = ($TABLE === $row["table"] ? $source : get_vals("SHOW COLUMNS FROM " .
 $j = 0;
 foreach ($row["source"] as $key => $val) {
        echo "<tr>";
-       echo "<td><select name='source[" . intval($key) . "]'" . ($j == count($row["source"]) - 1 ? " onchange='foreign_add_row(this);'" : "") . "><option>" . optionlist($source, $val) . "</select>";
-       echo "<td><select name='target[" . intval($key) . "]'>" . optionlist($target, $row["target"][$key]) . "</select>";
+       echo "<td>" . html_select("source[" . intval($key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreign_add_row(this);" : 1));
+       echo "<td>" . html_select("target[" . intval($key) . "]", $target, $row["target"][$key]);
        $j++;
 }
 ?>
 </table>
 <p>
-<?php echo lang('ON DELETE'); ?>: <select name="on_delete"><option><?php echo optionlist($on_actions, $row["on_delete"]); ?></select>
-<?php echo lang('ON UPDATE'); ?>: <select name="on_update"><option><?php echo optionlist($on_actions, $row["on_update"]); ?></select>
+<?php echo lang('ON DELETE'); ?>: <?php echo html_select("on_delete", array(-1 => "") + $on_actions, $row["on_delete"]); ?>
+ <?php echo lang('ON UPDATE'); ?>: <?php echo html_select("on_update", array(-1 => "") + $on_actions, $row["on_update"]); ?>
 <p>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <input type="submit" value="<?php echo lang('Save'); ?>">
index 03e10362ba061b7d0275193059e9d28491ff8627..bea746514d790e7bec8c2b2323d9955c7c6fe04a 100644 (file)
@@ -162,11 +162,11 @@ class Adminer {
                $fun_group = array(lang('Functions') => $this->functions, lang('Aggregation') => $this->grouping);
                foreach ($select as $key => $val) {
                        $val = $_GET["columns"][$key];
-                       echo "<div><select name='columns[$i][fun]'><option>" . optionlist($fun_group, $val["fun"]) . "</select>";
+                       echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, $val["fun"]);
                        echo "<select name='columns[$i][col]'><option>" . optionlist($columns, $val["col"], true) . "</select></div>\n";
                        $i++;
                }
-               echo "<div><select name='columns[$i][fun]' onchange='this.nextSibling.onchange();'><option>" . optionlist($fun_group) . "</select>";
+               echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, "", "this.nextSibling.onchange();");
                echo "<select name='columns[$i][col]' onchange='select_add_row(this);'><option>" . optionlist($columns, null, true) . "</select></div>\n";
                echo "</div></fieldset>\n";
        }
@@ -191,13 +191,13 @@ class Adminer {
                foreach ((array) $_GET["where"] as $val) {
                        if (strlen("$val[col]$val[val]") && in_array($val["op"], $this->operators)) {
                                echo "<div><select name='where[$i][col]'><option value=''>" . lang('(anywhere)') . optionlist($columns, $val["col"], true) . "</select>";
-                               echo "<select name='where[$i][op]'>" . optionlist($this->operators, $val["op"]) . "</select>";
+                               echo html_select("where[$i][op]", $this->operators, $val["op"]);
                                echo "<input name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
                                $i++;
                        }
                }
                echo "<div><select name='where[$i][col]' onchange='select_add_row(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>";
-               echo "<select name='where[$i][op]'>" . optionlist($this->operators) . "</select>";
+               echo html_select("where[$i][op]", $this->operators);
                echo "<input name='where[$i][val]'></div>\n";
                echo "</div></fieldset>\n";
        }
@@ -482,11 +482,7 @@ class Adminer {
 <p>
 <?php if (SID) { ?><input type="hidden" name="<?php echo session_name(); ?>" value="<?php echo h(session_id()); ?>"><?php } ?>
 <?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo h($_GET["server"]); ?>"><?php } ?>
-<?php if ($databases) { ?>
-<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)<?php echo optionlist($databases, DB); ?></select>
-<?php } else { ?>
-<input name="db" value="<?php echo h(DB); ?>">
-<?php } ?>
+<?php echo ($databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">'); ?>
 <?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value=""><?php } ?>
 <?php if (isset($_GET["schema"])) { ?><input type="hidden" name="schema" value=""><?php } ?>
 <?php if (isset($_GET["dump"])) { ?><input type="hidden" name="dump" value=""><?php } ?>
index 6b22e0a69e46b14abb84d97d64f780464f2d1522..ffc4d3b8d7dc24548c53f7e63635a2457cecb0b0 100644 (file)
@@ -97,7 +97,7 @@ function referencable_primary($self) {
 function edit_type($key, $field, $collations, $foreign_keys = array()) {
        global $structured_types, $unsigned, $inout;
        ?>
-<td><select name="<?php echo $key; ?>[type]" class="type" onchange="editing_type_change(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); // foreign keys can be wide but style="width: 15ex;" narrows expanded optionlist in IE too ?></select>
+<td><select name="<?php echo $key; ?>[type]" class="type" onchange="editing_type_change(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select>
 <td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3">
 <td><?php
 echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
@@ -172,7 +172,11 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
                $display = (isset($_POST["add"][$i-1]) || (isset($field["field"]) && !$_POST["drop_col"][$i]));
                ?>
 <tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
-<?php if ($type == "PROCEDURE") { ?><td><select name="fields[<?php echo $i; ?>][inout]"><?php echo optionlist($inout, $field["inout"]); ?></select><?php } ?>
+<?php
+if ($type == "PROCEDURE") {
+       echo "<td>" . html_select("fields[$i][inout]", $inout, $field["inout"]);
+}
+?>
 <th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo (strlen($field["field"]) || count($fields) > 1 ? "" : "editing_add_row(this, $allowed); "); ?>editing_name_change(this);" maxlength="64"><?php } ?><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($field[($_POST ? "orig" : "field")]); ?>">
 <?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
 <?php if ($type == "TABLE") { ?>
index 72b64ab27ed27311a316ba085663dde7f46991cf..cf3133251142b2125ce7e3f3e75ecbaafdf11c3a 100644 (file)
@@ -78,12 +78,12 @@ function checkbox($name, $value, $checked, $label = "", $onclick = "") {
 * @param string
 * @param array
 * @param string
-* @param bool generate select (otherwise radio)
+* @param string true for no onchange, false for radio
 * @return string
 */
-function html_select($name, $options, $value, $select = true) {
-       if ($select) {
-               return "<select name='" . h($name) . "'>" . optionlist($options, $value) . "</select>";
+function html_select($name, $options, $value = "", $onchange = true) {
+       if ($onchange) {
+               return "<select name='" . h($name) . "'" . (is_string($onchange) ? " onchange=\"$onchange\"" : "") . ">" . optionlist($options, $value) . "</select>";
        }
        $return = "";
        foreach ($options as $key => $val) {
@@ -418,7 +418,7 @@ function input($field, $value, $function) {
                        $first++;
                }
                $onchange = ($first ? " onchange=\"var f = this.form['function[" . addcslashes($name, "\r\n'\\") . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
-               echo (count($functions) > 1 ? "<select name='function[$name]'>" . optionlist($functions, !isset($function) || in_array($function, $functions) ? $function : "") . "</select>" : nbsp(reset($functions))) . '<td>';
+               echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) ? $function : "") : nbsp(reset($functions))) . '<td>';
                $input = $adminer->editInput($_GET["edit"], $field, " name='fields[$name]'$onchange", $value); // usage in call is without a table
                if (strlen($input)) {
                        echo $input;
index 0f8b4154836cb67f07495e0278b633c975bdae31..74f84b69ebe59cdf8ea4c7a963baadb79849f44b 100644 (file)
@@ -32,9 +32,9 @@ function switch_lang() {
        global $LANG, $langs;
        echo "<form action=''>\n<div id='lang'>";
        hidden_fields($_GET, array('lang'));
-       echo lang('Language') . ": <select name='lang' onchange='this.form.submit();'>";
-       echo optionlist($langs, $LANG);
-       echo "</select>\n<noscript><div style='display: inline;'><input type='submit' value='" . lang('Use') . "'></div></noscript>\n</div>\n</form>\n";
+       echo lang('Language') . ": " . html_select("lang", $langs, $LANG, "this.form.submit();");
+       echo "<noscript><div style='display: inline;'><input type='submit' value='" . lang('Use') . "'></div></noscript>\n";
+       echo "</div>\n</form>\n";
 }
 
 if (isset($_GET["lang"])) {
index 14442144fd511f4c999f2883f61e7a5d36c7b446..b25e63ca6b9d9d24f16ba6a8af88e2562f4597e0 100644 (file)
@@ -73,10 +73,10 @@ if ($_POST) {
 <?php
 $j = 0;
 foreach ($row["indexes"] as $index) {
-       echo "<tr><td><select name='indexes[$j][type]'" . ($j == count($row["indexes"]) - 1 ? " onchange='indexes_add_row(this);'" : "") . "><option>" . optionlist($index_types, $index["type"]) . "</select><td>\n";
+       echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) - 1 ? "indexes_add_row(this);" : 1)) . "<td>\n";
        ksort($index["columns"]);
        foreach ($index["columns"] as $i => $column) {
-               echo "<span><select name='indexes[$j][columns][$i]'" . ($i == count($index["columns"]) ? " onchange='indexes_add_column(this);'" : "") . "><option>" . optionlist($fields, $column) . "</select>";
+               echo "<span>" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexes_add_column(this);" : 1));
                echo "<input name='indexes[$j][lengths][$i]' size='2' value='" . h($index["lengths"][$i]) . "'> </span>\n";
        }
        echo "\n";
index be90d846c6cb1f556c7d36f1cc6ca5554c267efd..03d794f9e30346d4d28e049ac34ab5ef72612ae3 100644 (file)
@@ -28,8 +28,8 @@ if ($_POST) {
 
 <form action="" method="post" id="form">
 <table cellspacing="0">
-<tr><th><?php echo lang('Time'); ?><td><select name="Timing" onchange="if (/^<?php echo h(preg_quote($TABLE, "/")); ?>_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '<?php echo h(addcslashes($TABLE, "\r\n'\\")); ?>_' + select_value(this).charAt(0).toLowerCase() + select_value(this.form['Event']).charAt(0).toLowerCase();"><?php echo optionlist($trigger_time, $row["Timing"]); ?></select>
-<tr><th><?php echo lang('Event'); ?><td><select name="Event" onchange="this.form['Timing'].onchange();"><?php echo optionlist($trigger_event, $row["Event"]); ?></select>
+<tr><th><?php echo lang('Time'); ?><td><?php echo html_select("Timing", $trigger_time, $row["Timing"], "if (/^" . h(preg_quote($TABLE, "/")) . "_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '" . h(addcslashes($TABLE, "\r\n'\\")) . "_' + select_value(this).charAt(0).toLowerCase() + select_value(this.form['Event']).charAt(0).toLowerCase();"); ?>
+<tr><th><?php echo lang('Event'); ?><td><?php echo html_select("Event", $trigger_event, $row["Event"], "this.form['Timing'].onchange();"); ?>
 <tr><th><?php echo lang('Name'); ?><td><input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64">
 </table>
 <p><textarea name="Statement" rows="10" cols="80" style="width: 98%;"><?php echo h($row["Statement"]); ?></textarea>
index 60bc7a368417a625e399f2172e32841128a77c94..9160de1eac15be252e60bb59ed9b45f3c451eb78 100644 (file)
@@ -174,13 +174,13 @@ ORDER BY ORDINAL_POSITION");
                foreach ((array) $_GET["where"] as $val) {
                        if (strlen("$val[col]$val[val]")) {
                                echo "<div><select name='where[$i][col]'><option value=''>" . lang('(anywhere)') . optionlist($columns, $val["col"], true) . "</select>";
-                               echo "<select name='where[$i][op]'><option>" . optionlist($this->operators, $val["op"]) . "</select>";
+                               echo html_select("where[$i][op]", array(-1 => "") + $this->operators, $val["op"]);
                                echo "<input name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
                                $i++;
                        }
                }
                echo "<div><select name='where[$i][col]' onchange='select_add_row(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>";
-               echo "<select name='where[$i][op]'><option>" . optionlist($this->operators) . "</select>";
+               echo html_select("where[$i][op]", array(-1 => "") + $this->operators);
                echo "<input name='where[$i][val]'></div>\n";
                echo "</div></fieldset>\n";
        }
@@ -206,7 +206,7 @@ ORDER BY ORDINAL_POSITION");
        
        function selectLimitPrint($limit) {
                echo "<fieldset><legend>" . lang('Limit') . "</legend><div>"; // <div> for easy styling
-               echo "<select name='limit'>" . optionlist(array("", "30", "100"), $limit) . "</select>";
+               echo html_select("limit", array("", "30", "100"), $limit);
                echo "</div></fieldset>\n";
        }
        
@@ -225,9 +225,9 @@ ORDER BY ORDINAL_POSITION");
                        echo "<p>" . lang('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
                        echo lang('Subject') . ": <input name='email_subject' value='" . h($_POST["email_subject"]) . "'>\n";
                        echo "<p><textarea name='email_message' rows='15' cols='60'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n";
-                       echo "<select name='email_addition'>" . optionlist($columns, $_POST["email_addition"]) . "</select> <input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript
+                       echo html_select("email_addition", $columns, $_POST["email_addition"]) . "<input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript
                        echo "<p><input type='file' name='email_files[]' onchange=\"var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el); this.onchange = function () { };\">";
-                       echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : '<select name="email_field">' . optionlist($emailFields) . '</select> ');
+                       echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
                        echo "<input type='submit' name='email' value='" . lang('Send') . "' onclick=\"return this.form['delete'].onclick();\">\n";
                        echo "</div></fieldset>\n";
                }