function country_list() { global $serviceproviders; $country_list = get_country_codes(); foreach ($serviceproviders as $sp) { foreach ($country_list as $code => $country) { if (strtoupper($sp['attr']['code']) == $code) { echo $country . ":" . $code . "\n"; } } } }
function display_countries($name = 'country', $selected = '', $extras = '') { $output = ''; $countries = get_country_codes(); $output .= '<select name="' . $name . '" ' . $extras . '>' . "\n"; foreach ($countries as $country => $name) { $name = ucwords(strtolower($name)); $output .= '<option value="' . $country . '"'; if ($country == $selected || $selected == '' && $country == 'US') { $output .= ' selected="selected"'; } $output .= '>' . $name . '</option>' . "\n"; } $output .= '</select>' . "\n"; return $output; }
<tr> <td width="22%" valign="top" class="vncellreq"><?php echo gettext("Distinguished name"); ?> </td> <td width="78%" class="vtable"> <table border="0" cellspacing="0" cellpadding="2" summary="name"> <tr> <td align="right"><?php echo gettext("Country Code"); ?> : </td> <td align="left"> <select name='dn_country' class="selectpicker"> <?php $dn_cc = get_country_codes(); foreach ($dn_cc as $cc => $cn) { $selected = ''; if (isset($pconfig['dn_country']) && $pconfig['dn_country'] == $cc) { $selected = ' selected="selected"'; } print "<option value=\"{$cc}\"{$selected}>{$cc} ({$cn})</option>"; } ?> </select> </td> </tr> <tr> <td align="right"><?php echo gettext("State or Province"); ?>
</tr> <tr> <th colspan="2"><?php echo gettext("Distinguished name"); ?> </th> </tr> <tr> <td><i class="fa fa-info-circle text-muted"></i> <?php echo gettext("Country Code"); ?> : </td> <td> <select name="csr_dn_country" id="csr_dn_country" class="selectpicker"> <?php foreach (get_country_codes() as $cc => $cn) { ?> <option value="<?php echo $cc; ?> " <?php echo $pconfig['csr_dn_country'] == $cc ? "selected=\"selected\"" : ""; ?> > <?php echo $cc; ?> (<?php echo $cn; ?> )