public function CrearCombo2Valores($entidad, $secondVal, $displayValue, $selectedId, $Filtro = "") { if ($Filtro != "") { $Filtro = " WHERE " . $Filtro; } $keyValue = 'id' . $entidad; $result = "<select name='combo{$entidad}' id='combo{$entidad}' onchange='javascript:void(comboDependiente{$entidad}());'>"; if ($selectedId == 0) { $result .= "<option value='0' selected></option>"; } $recordset = parent::query("Select * from {$entidad} {$Filtro}"); while ($records = parent::handle($recordset)) { $value = $records->{$displayValue}; $key = $records->{$keyValue}; $key2 = $records->{$secondVal}; if ($key == $selectedId) { $result .= "<option value='{$key}#{$key2}' selected>{$value}</option>"; } else { $result .= "<option value='{$key}#{$key2}'>{$value}</option>"; } } $result .= '</select>'; return $result; }