function argv2request($args=null) { return nb::argv2request($args); }
-function html_select_array($data,$opt=array()) {
+function html_select_array($data,$opt=[]) {
$html = '<select';
if (!empty($opt['html'])) $html .= ' '.preg_replace('/^\s+/','',$opt['html']);
else $opt['sort']($data);
}
+ $default = '';
+ if (!empty($opt['default_value'])) $default = $opt['default_value'];
+
foreach ($data as $d) {
if (is_array($d)) {
$lib = htmlentities($lib);
if (!empty($opt['prettyText'])) $lib = prettyText($lib);
- $html .= '<option value="'.$val.'"'
+ $html .= '<option value="'.($default == $val ? '' : $val).'"'
.( ($opt['selected']!==NULL and strcmp((string)$opt['selected'],$val)===0) ?' selected="selected"':'')
.'>'.$lib.'</option>'.NB_EOL;
}
public function limit($set=false) {
- static $limit=false;
+ static $limit = false;
if ($set !== false) return ($limit = $set);
if ($limit !== false) return $limit;