private function generateCountries($selected = '') { $countries = Country::getAll(); echo '<select class="field" id="country" name="country">' . "\n"; if ($selected == '') { echo '<option value="0" selected>Please select a country</option>' . "\n"; } foreach ($countries as $country) { if ($country['country_code'] != $selected) { echo '<option value="' . $country['country_code'] . '">' . $country['country'] . '</option>' . "\n"; } else { echo '<option value="' . $country['country_code'] . '" selected>' . $country['country'] . '</option>' . "\n"; } } echo '</select>' . "\n"; }
</div> <div class="box-content"> <form action="#" method="POST"> <table style="margin-left: 20%;" width="100%" > <tr> <td><label class="control-label" for="selectError">Country</label></td> <td> <div class="input-group" style="width: 50%"> <span class="input-group-addon"></span> <select required="" name="country_id" class="form-control"> <option value="">--Select Country--</option> <?php $countryObj = new Country(); $rows = $countryObj->getAll(); foreach ($rows as $row) { ?> <option value="<?php echo $row['id']; ?> "><?php echo $row['name']; ?> </option> <?php } ?> </select> </div> </td>
/** * Display a listing of the resource. * * @return Response */ public function index() { $tags = $this->tagRepository->getAll(); $this->render('admin.tags.index', compact('tags')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $countries = $this->countryRepository->getAll(); $this->render('admin.countries.index', compact('countries')); }
private function generateCountriesDropdown($_for_quick_upload = false, $_for_referrer = false) { $countries = Country::getAll(); $prefix = $_for_quick_upload ? 'qu' : 'qr'; $prefix .= $_for_referrer ? '_referrer' : '_candidate'; echo '<select class="mini_field" id="' . $prefix . '_country" name="' . $prefix . '_country">' . "\n"; echo '<option value="0" selected>Country of residence</option>' . "\n"; echo '<option value="0" disabled> </option>' . "\n"; foreach ($countries as $country) { echo '<option value="' . $country['country_code'] . '">' . $country['country'] . '</option>' . "\n"; } echo '</select>' . "\n"; }
<?php require_once dirname(__FILE__) . "/../../private/lib/utilities.php"; header('Content-type: text/xml'); $xml_dom = new XMLDOM(); $response = array(); $result = Country::getAll(); $i = 0; foreach ($result as $row) { $response[$i]['country_code'] = $row['country_code']; $response[$i]['name'] = $row['country']; $i++; } $xml_array = array('countries' => array('country' => $response)); echo $xml_dom->get_xml_from_array($xml_array);