function build_operators_list($country_id, $page = "add", $onclick = "", $selected_client = "") { $db_functions_obj = new DbFunctions(); $helper_obj = new Helper(); $operators = $db_functions_obj->get_operators_by_country($country_id); $output = "<select {$onclick} id='{$page}" . "_operator' name='{$page}" . "_operator'>"; foreach ($operators as $key => $value) { if ($selected_client != "") { $output .= "<option "; if ($selected_client == $value->id) { $output .= " selected='selected' "; } $output .= "value='{$value->id}'>{$value->name}</option>"; } else { $output .= "<option value='{$value->id}'>{$value->name}</option>"; } } $output .= "</select>"; return $output; }