Rumah > pembangunan bahagian belakang > tutorial php > php实现的美国50个州选择列表实例_php技巧

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

WBOY
Lepaskan: 2016-05-16 20:16:51
asal
992 orang telah melayarinya

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

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

<select name="state" id="state">
  <option value="AL" <&#63;PHP if($state=="AL") echo "selected";&#63;>>Alabama</option>
  <option value="AK" <&#63;PHP if($state=="AK") echo "selected";&#63;>>Alaska</option>
  <option value="AZ" <&#63;PHP if($state=="AZ") echo "selected";&#63;>>Arizona</option>
  <option value="AR" <&#63;PHP if($state=="AR") echo "selected";&#63;>>Arkansas</option>
  <option value="CA" <&#63;PHP if($state=="CA") echo "selected";&#63;>>California</option>
  <option value="CO" <&#63;PHP if($state=="CO") echo "selected";&#63;>>Colorado</option>
  <option value="CT" <&#63;PHP if($state=="CT") echo "selected";&#63;>>Connecticut</option>
  <option value="DE" <&#63;PHP if($state=="DE") echo "selected";&#63;>>Delaware</option>
  <option value="DC" <&#63;PHP if($state=="DC") echo "selected";&#63;>>District of Columbia</option>
  <option value="FL" <&#63;PHP if($state=="FL") echo "selected";&#63;>>Florida</option>
  <option value="GA" <&#63;PHP if($state=="GA") echo "selected";&#63;>>Georgia</option>
  <option value="HI" <&#63;PHP if($state=="HI") echo "selected";&#63;>>Hawaii</option>
  <option value="ID" <&#63;PHP if($state=="ID") echo "selected";&#63;>>Idaho</option>
  <option value="IL" <&#63;PHP if($state=="IL") echo "selected";&#63;>>Illinois</option>
  <option value="IN" <&#63;PHP if($state=="IN") echo "selected";&#63;>>Indiana</option>
  <option value="IA" <&#63;PHP if($state=="IA") echo "selected";&#63;>>Iowa</option>
  <option value="KS" <&#63;PHP if($state=="KS") echo "selected";&#63;>>Kansas</option>
  <option value="KY" <&#63;PHP if($state=="KY") echo "selected";&#63;>>Kentucky</option>
  <option value="LA" <&#63;PHP if($state=="LA") echo "selected";&#63;>>Louisiana</option>
  <option value="ME" <&#63;PHP if($state=="ME") echo "selected";&#63;>>Maine</option>
  <option value="MD" <&#63;PHP if($state=="MD") echo "selected";&#63;>>Maryland</option>
  <option value="MA" <&#63;PHP if($state=="MA") echo "selected";&#63;>>Massachusetts</option>
  <option value="MI" <&#63;PHP if($state=="MI") echo "selected";&#63;>>Michigan</option>
  <option value="MN" <&#63;PHP if($state=="MN") echo "selected";&#63;>>Minnesota</option>
  <option value="MS" <&#63;PHP if($state=="MS") echo "selected";&#63;>>Mississippi</option>
  <option value="MO" <&#63;PHP if($state=="MO") echo "selected";&#63;>>Missouri</option>
  <option value="MT" <&#63;PHP if($state=="MT") echo "selected";&#63;>>Montana</option>
  <option value="NE" <&#63;PHP if($state=="NE") echo "selected";&#63;>>Nebraska</option>
  <option value="NV" <&#63;PHP if($state=="NV") echo "selected";&#63;>>Nevada</option>
  <option value="NH" <&#63;PHP if($state=="NH") echo "selected";&#63;>>New Hampshire</option>
  <option value="NJ" <&#63;PHP if($state=="NJ") echo "selected";&#63;>>New Jersey</option>
  <option value="NM" <&#63;PHP if($state=="NM") echo "selected";&#63;>>New Mexico</option>
  <option value="NY" <&#63;PHP if($state=="NY") echo "selected";&#63;>>New York</option>
  <option value="NC" <&#63;PHP if($state=="NC") echo "selected";&#63;>>North Carolina</option>
  <option value="ND" <&#63;PHP if($state=="ND") echo "selected";&#63;>>North Dakota</option>
  <option value="OH" <&#63;PHP if($state=="OH") echo "selected";&#63;>>Ohio</option>
  <option value="OK" <&#63;PHP if($state=="OK") echo "selected";&#63;>>Oklahoma</option>
  <option value="OR" <&#63;PHP if($state=="OR") echo "selected";&#63;>>Oregon</option>
  <option value="PA" <&#63;PHP if($state=="PA") echo "selected";&#63;>>Pennsylvania</option>
  <option value="RI" <&#63;PHP if($state=="RI") echo "selected";&#63;>>Rhode Island</option>
  <option value="SC" <&#63;PHP if($state=="SC") echo "selected";&#63;>>South Carolina</option>
  <option value="SD" <&#63;PHP if($state=="SD") echo "selected";&#63;>>South Dakota</option>
  <option value="TN" <&#63;PHP if($state=="TN") echo "selected";&#63;>>Tennessee</option>
  <option value="TX" <&#63;PHP if($state=="TX") echo "selected";&#63;>>Texas</option>
  <option value="UT" <&#63;PHP if($state=="UT") echo "selected";&#63;>>Utah</option>
  <option value="VT" <&#63;PHP if($state=="VT") echo "selected";&#63;>>Vermont</option>
  <option value="VA" <&#63;PHP if($state=="VA") echo "selected";&#63;>>Virginia</option>
  <option value="WA" <&#63;PHP if($state=="WA") echo "selected";&#63;>>Washington</option>
  <option value="WV" <&#63;PHP if($state=="WV") echo "selected";&#63;>>West Virginia</option>
  <option value="WI" <&#63;PHP if($state=="WI") echo "selected";&#63;>>Wisconsin</option>
  <option value="WY" <&#63;PHP if($state=="WY") echo "selected";&#63;>>Wyoming</option>
</select>
Salin selepas log masuk

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

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan