欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

php实现的美国50个州选择列表实例

程序员文章站 2022-05-27 14:34:35
本文实例讲述了php实现的美国50个州选择列表。分享给大家供大家参考。具体如下: 这里展示的是php生成的美国50个州的选择列表,自动选择当前州

本文实例讲述了php实现的美国50个州选择列表。分享给大家供大家参考。具体如下:

这里展示的是php生成的美国50个州的选择列表,自动选择当前州

<select name="state" id="state">
  <option value="al" <?php if($state=="al") echo "selected";?>>alabama</option>
  <option value="ak" <?php if($state=="ak") echo "selected";?>>alaska</option>
  <option value="az" <?php if($state=="az") echo "selected";?>>arizona</option>
  <option value="ar" <?php if($state=="ar") echo "selected";?>>arkansas</option>
  <option value="ca" <?php if($state=="ca") echo "selected";?>>california</option>
  <option value="co" <?php if($state=="co") echo "selected";?>>colorado</option>
  <option value="ct" <?php if($state=="ct") echo "selected";?>>connecticut</option>
  <option value="de" <?php if($state=="de") echo "selected";?>>delaware</option>
  <option value="dc" <?php if($state=="dc") echo "selected";?>>district of columbia</option>
  <option value="fl" <?php if($state=="fl") echo "selected";?>>florida</option>
  <option value="ga" <?php if($state=="ga") echo "selected";?>>georgia</option>
  <option value="hi" <?php if($state=="hi") echo "selected";?>>hawaii</option>
  <option value="id" <?php if($state=="id") echo "selected";?>>idaho</option>
  <option value="il" <?php if($state=="il") echo "selected";?>>illinois</option>
  <option value="in" <?php if($state=="in") echo "selected";?>>indiana</option>
  <option value="ia" <?php if($state=="ia") echo "selected";?>>iowa</option>
  <option value="ks" <?php if($state=="ks") echo "selected";?>>kansas</option>
  <option value="ky" <?php if($state=="ky") echo "selected";?>>kentucky</option>
  <option value="la" <?php if($state=="la") echo "selected";?>>louisiana</option>
  <option value="me" <?php if($state=="me") echo "selected";?>>maine</option>
  <option value="md" <?php if($state=="md") echo "selected";?>>maryland</option>
  <option value="ma" <?php if($state=="ma") echo "selected";?>>massachusetts</option>
  <option value="mi" <?php if($state=="mi") echo "selected";?>>michigan</option>
  <option value="mn" <?php if($state=="mn") echo "selected";?>>minnesota</option>
  <option value="ms" <?php if($state=="ms") echo "selected";?>>mississippi</option>
  <option value="mo" <?php if($state=="mo") echo "selected";?>>missouri</option>
  <option value="mt" <?php if($state=="mt") echo "selected";?>>montana</option>
  <option value="ne" <?php if($state=="ne") echo "selected";?>>nebraska</option>
  <option value="nv" <?php if($state=="nv") echo "selected";?>>nevada</option>
  <option value="nh" <?php if($state=="nh") echo "selected";?>>new hampshire</option>
  <option value="nj" <?php if($state=="nj") echo "selected";?>>new jersey</option>
  <option value="nm" <?php if($state=="nm") echo "selected";?>>new mexico</option>
  <option value="ny" <?php if($state=="ny") echo "selected";?>>new york</option>
  <option value="nc" <?php if($state=="nc") echo "selected";?>>north carolina</option>
  <option value="nd" <?php if($state=="nd") echo "selected";?>>north dakota</option>
  <option value="oh" <?php if($state=="oh") echo "selected";?>>ohio</option>
  <option value="ok" <?php if($state=="ok") echo "selected";?>>oklahoma</option>
  <option value="or" <?php if($state=="or") echo "selected";?>>oregon</option>
  <option value="pa" <?php if($state=="pa") echo "selected";?>>pennsylvania</option>
  <option value="ri" <?php if($state=="ri") echo "selected";?>>rhode island</option>
  <option value="sc" <?php if($state=="sc") echo "selected";?>>south carolina</option>
  <option value="sd" <?php if($state=="sd") echo "selected";?>>south dakota</option>
  <option value="tn" <?php if($state=="tn") echo "selected";?>>tennessee</option>
  <option value="tx" <?php if($state=="tx") echo "selected";?>>texas</option>
  <option value="ut" <?php if($state=="ut") echo "selected";?>>utah</option>
  <option value="vt" <?php if($state=="vt") echo "selected";?>>vermont</option>
  <option value="va" <?php if($state=="va") echo "selected";?>>virginia</option>
  <option value="wa" <?php if($state=="wa") echo "selected";?>>washington</option>
  <option value="wv" <?php if($state=="wv") echo "selected";?>>west virginia</option>
  <option value="wi" <?php if($state=="wi") echo "selected";?>>wisconsin</option>
  <option value="wy" <?php if($state=="wy") echo "selected";?>>wyoming</option>
</select>

希望本文所述对大家的php程序设计有所帮助。