在PHP

时间:2016-06-26 09:29:41

标签: php html sql

我有一个表单,用于选择列出来自sql的调用的国家/地区 现在如何为所有

放置标志
<div class="col-xs-12 marpad">
  <div class="labelsrch">Going from</div>
  <div class="inputwrp mapmrkr">
    <select class="custmselct padspl" name="nationality" required>
      <option value="" selected="selected">Tell us where are you from</option>
      <?php 
                   foreach($country as $each_countries){
                    ?>
        <option value="<?=$each_countries->iso_code?>">
          <?=$each_countries->country_name?>
        </option>
        <?php
                   }
                   ?>
    </select>
  </div>
</div>

2 个答案:

答案 0 :(得分:0)

您可以使用标记并从Semantic-UI中选择框:http://semantic-ui.com/collections/form.html#form(请参阅国家/地区选择框)

并更改&lt;我&gt; class为缩写国家名称,例如&#34; ir&#34;:&lt;我是=&#34; ir flag&#34;&gt;&lt; / I&GT;

您必须从数据库中获取此名称

   <div class="field">
      <label>Country</label>
      <div class="ui fluid search selection dropdown">
        <input type="hidden" name="country">
        <i class="dropdown icon"></i>
        <div class="default text">Select Country</div>
        <div class="menu">
    <div class="item" data-value="af"><i class="af flag"></i>Afghanistan</div>
    <div class="item" data-value="ax"><i class="ax flag"></i>Aland Islands</div>
    <div class="item" data-value="al"><i class="al flag"></i>Albania</div>
    <div class="item" data-value="dz"><i class="dz flag"></i>Algeria</div>
    <div class="item" data-value="as"><i class="as flag"></i>American Samoa</div>
    <div class="item" data-value="ad"><i class="ad flag"></i>Andorra</div>
    <div class="item" data-value="ao"><i class="ao flag"></i>Angola</div>
    <div class="item" data-value="ai"><i class="ai flag"></i>Anguilla</div>
  </div>
      </div>
    </div>
  </div>

答案 1 :(得分:0)

如果您不想将此现有代码用作以下代码: Flags

我会插入数据库图像名称或链接国家名称和ID。并且使用国家名称键入ajax显示标志。