Properly use for attribute for label tags on hostapd page.

Added support for id attribute for SelectorOptions function.

Signed-off-by: D9ping <D9ping@users.noreply.github.com>
This commit is contained in:
D9ping
2018-10-03 22:20:06 +02:00
parent b10b538896
commit 73f5e4f2da
2 changed files with 28 additions and 23 deletions

View File

@@ -89,8 +89,13 @@ function isAssoc($arr) {
* If $options is an associative array this should be the key
*
*/
function SelectorOptions($name, $options, $selected = null) {
echo '<select class="form-control" name="'.htmlspecialchars($name, ENT_QUOTES).'">' , PHP_EOL;
function SelectorOptions($name, $options, $selected = null, $id = null) {
echo '<select class="form-control" name="'.htmlspecialchars($name, ENT_QUOTES).'"';
if (isset($id)) {
echo ' id="' . htmlspecialchars($id, ENT_QUOTES) .'"';
}
echo '>' , PHP_EOL;
foreach ( $options as $opt => $label) {
$select = '';
$key = isAssoc($options) ? $opt : $label;