更高效的方法来显示PHP中的国家/地区列表而不仅仅是在HTML中?

时间:2015-01-15 15:54:27

标签: php html loops select

我有如下所示的当前国家/地区列表,我想使用循环显示所有这些国家/地区,只需使用较少的代码来完成所有操作,以便在加载时显示的页面更快,这可能吗?< / p>

由于

<select class="textbox-fixed-noimage" name="ADDRESS_COUNTRY">
    <option<?=$ADDRESS_COUNTRY == 'Afghanistan' ? ' selected="selected"' : '' ;?> value="Afghanistan">Afghanistan</option>
    <option<?=$ADDRESS_COUNTRY == 'Aland Islands' ? ' selected="selected"' : '' ;?> value="Aland Islands">Aland Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Albania' ? ' selected="selected"' : '' ;?> value="Albania">Albania</option>
    <option<?=$ADDRESS_COUNTRY == 'Algeria' ? ' selected="selected"' : '' ;?> value="Algeria">Algeria</option>
    <option<?=$ADDRESS_COUNTRY == 'American' ? ' selected="selected"' : '' ;?> value="American Samoa">American Samoa</option>
    <option<?=$ADDRESS_COUNTRY == 'Andorra' ? ' selected="selected"' : '' ;?> value="Andorra">Andorra</option>
    <option<?=$ADDRESS_COUNTRY == 'Angola' ? ' selected="selected"' : '' ;?> value="Angola">Angola</option>
    <option<?=$ADDRESS_COUNTRY == 'Anguilla' ? ' selected="selected"' : '' ;?> value="Anguilla">Anguilla</option>
    <option<?=$ADDRESS_COUNTRY == 'Antarctica' ? ' selected="selected"' : '' ;?> value="Antarctica">Antarctica</option>
    <option<?=$ADDRESS_COUNTRY == 'Antigua and Barbuda' ? ' selected="selected"' : '' ;?> value="Antigua and Barbuda">Antigua and Barbuda</option>
    <option<?=$ADDRESS_COUNTRY == 'Argentina' ? ' selected="selected"' : '' ;?> value="Argentina">Argentina</option>
    <option<?=$ADDRESS_COUNTRY == 'Armenia' ? ' selected="selected"' : '' ;?> value="Armenia">Armenia</option>
    <option<?=$ADDRESS_COUNTRY == 'Aruba' ? ' selected="selected"' : '' ;?> value="Aruba">Aruba</option>
    <option<?=$ADDRESS_COUNTRY == 'Australia' ? ' selected="selected"' : '' ;?> value="Australia">Australia</option>
    <option<?=$ADDRESS_COUNTRY == 'Austria' ? ' selected="selected"' : '' ;?> value="Austria">Austria</option>
    <option<?=$ADDRESS_COUNTRY == 'Azerbaijan' ? ' selected="selected"' : '' ;?> value="Azerbaijan">Azerbaijan</option>
    <option<?=$ADDRESS_COUNTRY == 'Bahamas' ? ' selected="selected"' : '' ;?> value="Bahamas">Bahamas</option>
    <option<?=$ADDRESS_COUNTRY == 'Bahrain' ? ' selected="selected"' : '' ;?> value="Bahrain">Bahrain</option>
    <option<?=$ADDRESS_COUNTRY == 'Bangladesh' ? ' selected="selected"' : '' ;?> value="Bangladesh">Bangladesh</option>
    <option<?=$ADDRESS_COUNTRY == 'Barbados' ? ' selected="selected"' : '' ;?> value="Barbados">Barbados</option>
    <option<?=$ADDRESS_COUNTRY == 'Belarus' ? ' selected="selected"' : '' ;?> value="Belarus">Belarus</option>
    <option<?=$ADDRESS_COUNTRY == 'Belgium' ? ' selected="selected"' : '' ;?> value="Belgium">Belgium</option>
    <option<?=$ADDRESS_COUNTRY == 'Belize' ? ' selected="selected"' : '' ;?> value="Belize">Belize</option>
    <option<?=$ADDRESS_COUNTRY == 'Benin' ? ' selected="selected"' : '' ;?> value="Benin">Benin</option>
    <option<?=$ADDRESS_COUNTRY == 'Bermuda' ? ' selected="selected"' : '' ;?> value="Bermuda">Bermuda</option>
    <option<?=$ADDRESS_COUNTRY == 'Bhutan' ? ' selected="selected"' : '' ;?> value="Bhutan">Bhutan</option>
    <option<?=$ADDRESS_COUNTRY == 'Bolivia' ? ' selected="selected"' : '' ;?> value="Bolivia">Bolivia</option>
    <option<?=$ADDRESS_COUNTRY == 'Bosnia and Herzegovina' ? ' selected="selected"' : '' ;?> value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
    <option<?=$ADDRESS_COUNTRY == 'Botswana' ? ' selected="selected"' : '' ;?> value="Botswana">Botswana</option>
    <option<?=$ADDRESS_COUNTRY == 'Bouvet Island' ? ' selected="selected"' : '' ;?> value="Bouvet Island">Bouvet Island</option>
    <option<?=$ADDRESS_COUNTRY == 'Brazil' ? ' selected="selected"' : '' ;?> value="Brazil">Brazil</option>
    <option<?=$ADDRESS_COUNTRY == 'British Indian Ocean Territory' ? ' selected="selected"' : '' ;?> value="British Indian Ocean Territory">British Indian Ocean Territory</option>
    <option<?=$ADDRESS_COUNTRY == 'Brunei Darussalam' ? ' selected="selected"' : '' ;?> value="Brunei Darussalam">Brunei Darussalam</option>
    <option<?=$ADDRESS_COUNTRY == 'Bulgaria' ? ' selected="selected"' : '' ;?> value="Bulgaria">Bulgaria</option>
    <option<?=$ADDRESS_COUNTRY == 'Burkina Faso' ? ' selected="selected"' : '' ;?> value="Burkina Faso">Burkina Faso</option>
    <option<?=$ADDRESS_COUNTRY == 'Burundi' ? ' selected="selected"' : '' ;?> value="Burundi">Burundi</option>
    <option<?=$ADDRESS_COUNTRY == 'Cambodia' ? ' selected="selected"' : '' ;?> value="Cambodia">Cambodia</option>
    <option<?=$ADDRESS_COUNTRY == 'Cameroon' ? ' selected="selected"' : '' ;?> value="Cameroon">Cameroon</option>
    <option<?=$ADDRESS_COUNTRY == 'Canada' ? ' selected="selected"' : '' ;?> value="Canada">Canada</option>
    <option<?=$ADDRESS_COUNTRY == 'Cape Verde' ? ' selected="selected"' : '' ;?> value="Cape Verde">Cape Verde</option>
    <option<?=$ADDRESS_COUNTRY == 'Cayman Islands' ? ' selected="selected"' : '' ;?> value="Cayman Islands">Cayman Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Central African Republic' ? ' selected="selected"' : '' ;?> value="Central African Republic">Central African Republic</option>
    <option<?=$ADDRESS_COUNTRY == 'Chad' ? ' selected="selected"' : '' ;?> value="Chad">Chad</option>
    <option<?=$ADDRESS_COUNTRY == 'Chile' ? ' selected="selected"' : '' ;?> value="Chile">Chile</option>
    <option<?=$ADDRESS_COUNTRY == 'China' ? ' selected="selected"' : '' ;?> value="China">China</option>
    <option<?=$ADDRESS_COUNTRY == 'Christmas Island' ? ' selected="selected"' : '' ;?> value="Christmas Island">Christmas Island</option>
    <option<?=$ADDRESS_COUNTRY == 'Cocos (Keeling) Islands' ? ' selected="selected"' : '' ;?> value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Colombia' ? ' selected="selected"' : '' ;?> value="Colombia">Colombia</option>
    <option<?=$ADDRESS_COUNTRY == 'Comoros' ? ' selected="selected"' : '' ;?> value="Comoros">Comoros</option>
    <option<?=$ADDRESS_COUNTRY == 'Congo' ? ' selected="selected"' : '' ;?> value="Congo">Congo</option>
    <option<?=$ADDRESS_COUNTRY == 'Congo, The Democratic Republic of The' ? ' selected="selected"' : '' ;?> value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
    <option<?=$ADDRESS_COUNTRY == 'Cook Islands' ? ' selected="selected"' : '' ;?> value="Cook Islands">Cook Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Costa Rica' ? ' selected="selected"' : '' ;?> value="Costa Rica">Costa Rica</option>
    <option<?=$ADDRESS_COUNTRY == 'Cote Divoire' ? ' selected="selected"' : '' ;?> value="Cote Divoire">Cote D'ivoire</option>
    <option<?=$ADDRESS_COUNTRY == 'Croatia' ? ' selected="selected"' : '' ;?> value="Croatia">Croatia</option>
    <option<?=$ADDRESS_COUNTRY == 'Cuba' ? ' selected="selected"' : '' ;?> value="Cuba">Cuba</option>
    <option<?=$ADDRESS_COUNTRY == 'Cyprus' ? ' selected="selected"' : '' ;?> value="Cyprus">Cyprus</option>
    <option<?=$ADDRESS_COUNTRY == 'Czech Republic' ? ' selected="selected"' : '' ;?> value="Czech Republic">Czech Republic</option>
    <option<?=$ADDRESS_COUNTRY == 'Denmark' ? ' selected="selected"' : '' ;?> value="Denmark">Denmark</option>
    <option<?=$ADDRESS_COUNTRY == 'Djibouti' ? ' selected="selected"' : '' ;?> value="Djibouti">Djibouti</option>
    <option<?=$ADDRESS_COUNTRY == 'Dominica' ? ' selected="selected"' : '' ;?> value="Dominica">Dominica</option>
    <option<?=$ADDRESS_COUNTRY == 'Dominican Republic' ? ' selected="selected"' : '' ;?> value="Dominican Republic">Dominican Republic</option>
    <option<?=$ADDRESS_COUNTRY == 'Ecuador' ? ' selected="selected"' : '' ;?> value="Ecuador">Ecuador</option>
    <option<?=$ADDRESS_COUNTRY == 'Egypt' ? ' selected="selected"' : '' ;?> value="Egypt">Egypt</option>
    <option<?=$ADDRESS_COUNTRY == 'El Salvador' ? ' selected="selected"' : '' ;?> value="El Salvador">El Salvador</option>
    <option<?=$ADDRESS_COUNTRY == 'Equatorial Guinea' ? ' selected="selected"' : '' ;?> value="Equatorial Guinea">Equatorial Guinea</option>
    <option<?=$ADDRESS_COUNTRY == 'Eritrea' ? ' selected="selected"' : '' ;?> value="Eritrea">Eritrea</option>
    <option<?=$ADDRESS_COUNTRY == 'Estonia' ? ' selected="selected"' : '' ;?> value="Estonia">Estonia</option>
    <option<?=$ADDRESS_COUNTRY == 'Ethiopia' ? ' selected="selected"' : '' ;?> value="Ethiopia">Ethiopia</option>
    <option<?=$ADDRESS_COUNTRY == 'Falkland Islands (Malvinas)' ? ' selected="selected"' : '' ;?> value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
    <option<?=$ADDRESS_COUNTRY == 'Faroe Islands' ? ' selected="selected"' : '' ;?> value="Faroe Islands">Faroe Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Fiji' ? ' selected="selected"' : '' ;?> value="Fiji">Fiji</option>
    <option<?=$ADDRESS_COUNTRY == 'Finland' ? ' selected="selected"' : '' ;?> value="Finland">Finland</option>
    <option<?=$ADDRESS_COUNTRY == 'France' ? ' selected="selected"' : '' ;?> value="France">France</option>
    <option<?=$ADDRESS_COUNTRY == 'French Guiana' ? ' selected="selected"' : '' ;?> value="French Guiana">French Guiana</option>
    <option<?=$ADDRESS_COUNTRY == 'French Polynesia' ? ' selected="selected"' : '' ;?> value="French Polynesia">French Polynesia</option>
    <option<?=$ADDRESS_COUNTRY == 'French Southern Territories' ? ' selected="selected"' : '' ;?> value="French Southern Territories">French Southern Territories</option>
    <option<?=$ADDRESS_COUNTRY == 'Gabon' ? ' selected="selected"' : '' ;?> value="Gabon">Gabon</option>
    <option<?=$ADDRESS_COUNTRY == 'Gambia' ? ' selected="selected"' : '' ;?> value="Gambia">Gambia</option>
    <option<?=$ADDRESS_COUNTRY == 'Georgia' ? ' selected="selected"' : '' ;?> value="Georgia">Georgia</option>
    <option<?=$ADDRESS_COUNTRY == 'Germany' ? ' selected="selected"' : '' ;?> value="Germany">Germany</option>
    <option<?=$ADDRESS_COUNTRY == 'Ghana' ? ' selected="selected"' : '' ;?> value="Ghana">Ghana</option>
    <option<?=$ADDRESS_COUNTRY == 'Gibraltar' ? ' selected="selected"' : '' ;?> value="Gibraltar">Gibraltar</option>
    <option<?=$ADDRESS_COUNTRY == 'Greece' ? ' selected="selected"' : '' ;?> value="Greece">Greece</option>
    <option<?=$ADDRESS_COUNTRY == 'Greenland' ? ' selected="selected"' : '' ;?> value="Greenland">Greenland</option>
    <option<?=$ADDRESS_COUNTRY == 'Grenada' ? ' selected="selected"' : '' ;?> value="Grenada">Grenada</option>
    <option<?=$ADDRESS_COUNTRY == 'Guadeloupe' ? ' selected="selected"' : '' ;?> value="Guadeloupe">Guadeloupe</option>
    <option<?=$ADDRESS_COUNTRY == 'Guam' ? ' selected="selected"' : '' ;?> value="Guam">Guam</option>
    <option<?=$ADDRESS_COUNTRY == 'Guatemala' ? ' selected="selected"' : '' ;?> value="Guatemala">Guatemala</option>
    <option<?=$ADDRESS_COUNTRY == 'Guernsey' ? ' selected="selected"' : '' ;?> value="Guernsey">Guernsey</option>
    <option<?=$ADDRESS_COUNTRY == 'Guinea' ? ' selected="selected"' : '' ;?> value="Guinea">Guinea</option>
    <option<?=$ADDRESS_COUNTRY == 'Guinea-bissau' ? ' selected="selected"' : '' ;?> value="Guinea-bissau">Guinea-bissau</option>
    <option<?=$ADDRESS_COUNTRY == 'Guyana' ? ' selected="selected"' : '' ;?> value="Guyana">Guyana</option>
    <option<?=$ADDRESS_COUNTRY == 'Haiti' ? ' selected="selected"' : '' ;?> value="Haiti">Haiti</option>
    <option<?=$ADDRESS_COUNTRY == 'Heard Island and Mcdonald Islands' ? ' selected="selected"' : '' ;?> value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Holy See (Vatican City State)' ? ' selected="selected"' : '' ;?> value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
    <option<?=$ADDRESS_COUNTRY == 'Honduras' ? ' selected="selected"' : '' ;?> value="Honduras">Honduras</option>
    <option<?=$ADDRESS_COUNTRY == 'Hong Kong' ? ' selected="selected"' : '' ;?> value="Hong Kong">Hong Kong</option>
    <option<?=$ADDRESS_COUNTRY == 'Hungary' ? ' selected="selected"' : '' ;?> value="Hungary">Hungary</option>
    <option<?=$ADDRESS_COUNTRY == 'Iceland' ? ' selected="selected"' : '' ;?> value="Iceland">Iceland</option>
    <option<?=$ADDRESS_COUNTRY == 'India' ? ' selected="selected"' : '' ;?> value="India">India</option>
    <option<?=$ADDRESS_COUNTRY == 'Indonesia' ? ' selected="selected"' : '' ;?> value="Indonesia">Indonesia</option>
    <option<?=$ADDRESS_COUNTRY == 'Iran' ? ' selected="selected"' : '' ;?> value="Iran">Iran</option>
    <option<?=$ADDRESS_COUNTRY == 'Iraq' ? ' selected="selected"' : '' ;?> value="Iraq">Iraq</option>
    <option<?=$ADDRESS_COUNTRY == 'Ireland' ? ' selected="selected"' : '' ;?> value="Ireland">Ireland</option>
    <option<?=$ADDRESS_COUNTRY == 'Isle of Man' ? ' selected="selected"' : '' ;?> value="Isle of Man">Isle of Man</option>
    <option<?=$ADDRESS_COUNTRY == 'Israel' ? ' selected="selected"' : '' ;?> value="Israel">Israel</option>
    <option<?=$ADDRESS_COUNTRY == 'Italy' ? ' selected="selected"' : '' ;?> value="Italy">Italy</option>
    <option<?=$ADDRESS_COUNTRY == 'Jamaica' ? ' selected="selected"' : '' ;?> value="Jamaica">Jamaica</option>
    <option<?=$ADDRESS_COUNTRY == 'Japan' ? ' selected="selected"' : '' ;?> value="Japan">Japan</option>
    <option<?=$ADDRESS_COUNTRY == 'Jersey' ? ' selected="selected"' : '' ;?> value="Jersey">Jersey</option>
    <option<?=$ADDRESS_COUNTRY == 'Jordan' ? ' selected="selected"' : '' ;?> value="Jordan">Jordan</option>
    <option<?=$ADDRESS_COUNTRY == 'Kazakhstan' ? ' selected="selected"' : '' ;?> value="Kazakhstan">Kazakhstan</option>
    <option<?=$ADDRESS_COUNTRY == 'Kenya' ? ' selected="selected"' : '' ;?> value="Kenya">Kenya</option>
    <option<?=$ADDRESS_COUNTRY == 'Kiribati' ? ' selected="selected"' : '' ;?> value="Kiribati">Kiribati</option>
    <option<?=$ADDRESS_COUNTRY == 'Korea, Democratic Peoples Republic of' ? ' selected="selected"' : '' ;?> value="Korea, Democratic Peoples Republic of">Korea, Democratic People's Republic of</option>
    <option<?=$ADDRESS_COUNTRY == 'Korea, Republic of' ? ' selected="selected"' : '' ;?> value="Korea, Republic of">Korea, Republic of</option>
    <option<?=$ADDRESS_COUNTRY == 'Kuwait' ? ' selected="selected"' : '' ;?> value="Kuwait">Kuwait</option>
    <option<?=$ADDRESS_COUNTRY == 'Kyrgyzstan' ? ' selected="selected"' : '' ;?> value="Kyrgyzstan">Kyrgyzstan</option>
    <option<?=$ADDRESS_COUNTRY == 'Lao Peoples Democratic Republic' ? ' selected="selected"' : '' ;?> value="Lao Peoples Democratic Republic">Lao People's Democratic Republic</option>
    <option<?=$ADDRESS_COUNTRY == 'Latvia' ? ' selected="selected"' : '' ;?> value="Latvia">Latvia</option>
    <option<?=$ADDRESS_COUNTRY == 'Lebanon' ? ' selected="selected"' : '' ;?> value="Lebanon">Lebanon</option>
    <option<?=$ADDRESS_COUNTRY == 'Lesotho' ? ' selected="selected"' : '' ;?> value="Lesotho">Lesotho</option>
    <option<?=$ADDRESS_COUNTRY == 'Liberia' ? ' selected="selected"' : '' ;?> value="Liberia">Liberia</option>
    <option<?=$ADDRESS_COUNTRY == 'Libyan Arab Jamahiriya' ? ' selected="selected"' : '' ;?> value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
    <option<?=$ADDRESS_COUNTRY == 'Liechtenstein' ? ' selected="selected"' : '' ;?> value="Liechtenstein">Liechtenstein</option>
    <option<?=$ADDRESS_COUNTRY == 'Lithuania' ? ' selected="selected"' : '' ;?> value="Lithuania">Lithuania</option>
    <option<?=$ADDRESS_COUNTRY == 'Luxembourg' ? ' selected="selected"' : '' ;?> value="Luxembourg">Luxembourg</option>
    <option<?=$ADDRESS_COUNTRY == 'Macao' ? ' selected="selected"' : '' ;?> value="Macao">Macao</option>
    <option<?=$ADDRESS_COUNTRY == 'Macedonia, The Former Yugoslav Republic of' ? ' selected="selected"' : '' ;?> value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
    <option<?=$ADDRESS_COUNTRY == 'Madagascar' ? ' selected="selected"' : '' ;?> value="Madagascar">Madagascar</option>
    <option<?=$ADDRESS_COUNTRY == 'Malawi' ? ' selected="selected"' : '' ;?> value="Malawi">Malawi</option>
    <option<?=$ADDRESS_COUNTRY == 'Malaysia' ? ' selected="selected"' : '' ;?> value="Malaysia">Malaysia</option>
    <option<?=$ADDRESS_COUNTRY == 'Maldives' ? ' selected="selected"' : '' ;?> value="Maldives">Maldives</option>
    <option<?=$ADDRESS_COUNTRY == 'Mali' ? ' selected="selected"' : '' ;?> value="Mali">Mali</option>
    <option<?=$ADDRESS_COUNTRY == 'Malta' ? ' selected="selected"' : '' ;?> value="Malta">Malta</option>
    <option<?=$ADDRESS_COUNTRY == 'Marshall Islands' ? ' selected="selected"' : '' ;?> value="Marshall Islands">Marshall Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Martinique' ? ' selected="selected"' : '' ;?> value="Martinique">Martinique</option>
    <option<?=$ADDRESS_COUNTRY == 'Mauritania' ? ' selected="selected"' : '' ;?> value="Mauritania">Mauritania</option>
    <option<?=$ADDRESS_COUNTRY == 'Mauritius' ? ' selected="selected"' : '' ;?> value="Mauritius">Mauritius</option>
    <option<?=$ADDRESS_COUNTRY == 'Mayotte' ? ' selected="selected"' : '' ;?> value="Mayotte">Mayotte</option>
    <option<?=$ADDRESS_COUNTRY == 'Mexico' ? ' selected="selected"' : '' ;?> value="Mexico">Mexico</option>
    <option<?=$ADDRESS_COUNTRY == 'Micronesia, Federated States of' ? ' selected="selected"' : '' ;?> value="Micronesia, Federated States of">Micronesia, Federated States of</option>
    <option<?=$ADDRESS_COUNTRY == 'Moldova, Republic of' ? ' selected="selected"' : '' ;?> value="Moldova, Republic of">Moldova, Republic of</option>
    <option<?=$ADDRESS_COUNTRY == 'Monaco ' ? ' selected="selected"' : '' ;?> value="Monaco">Monaco</option>
    <option<?=$ADDRESS_COUNTRY == 'Mongolia' ? ' selected="selected"' : '' ;?> value="Mongolia">Mongolia</option>
    <option<?=$ADDRESS_COUNTRY == 'Montenegro' ? ' selected="selected"' : '' ;?> value="Montenegro">Montenegro</option>
    <option<?=$ADDRESS_COUNTRY == 'Montserrat' ? ' selected="selected"' : '' ;?> value="Montserrat">Montserrat</option>
    <option<?=$ADDRESS_COUNTRY == 'Morocco' ? ' selected="selected"' : '' ;?> value="Morocco">Morocco</option>
    <option<?=$ADDRESS_COUNTRY == 'Mozambique' ? ' selected="selected"' : '' ;?> value="Mozambique">Mozambique</option>
    <option<?=$ADDRESS_COUNTRY == 'Myanmar' ? ' selected="selected"' : '' ;?> value="Myanmar">Myanmar</option>
    <option<?=$ADDRESS_COUNTRY == 'Namibia' ? ' selected="selected"' : '' ;?> value="Namibia">Namibia</option>
    <option<?=$ADDRESS_COUNTRY == 'Nauru' ? ' selected="selected"' : '' ;?> value="Nauru">Nauru</option>
    <option<?=$ADDRESS_COUNTRY == 'Nepal' ? ' selected="selected"' : '' ;?> value="Nepal">Nepal</option>
    <option<?=$ADDRESS_COUNTRY == 'Netherlands' ? ' selected="selected"' : '' ;?> value="Netherlands">Netherlands</option>
    <option<?=$ADDRESS_COUNTRY == 'Netherlands Antilles' ? ' selected="selected"' : '' ;?> value="Netherlands Antilles">Netherlands Antilles</option>
    <option<?=$ADDRESS_COUNTRY == 'New Caledonia' ? ' selected="selected"' : '' ;?> value="New Caledonia">New Caledonia</option>
    <option<?=$ADDRESS_COUNTRY == 'New Zealand' ? ' selected="selected"' : '' ;?> value="New Zealand">New Zealand</option>
    <option<?=$ADDRESS_COUNTRY == 'Nicaragua' ? ' selected="selected"' : '' ;?> value="Nicaragua">Nicaragua</option>
    <option<?=$ADDRESS_COUNTRY == 'Niger' ? ' selected="selected"' : '' ;?> value="Niger">Niger</option>
    <option<?=$ADDRESS_COUNTRY == 'Nigeria' ? ' selected="selected"' : '' ;?> value="Nigeria">Nigeria</option>
    <option<?=$ADDRESS_COUNTRY == 'Niue' ? ' selected="selected"' : '' ;?> value="Niue">Niue</option>
    <option<?=$ADDRESS_COUNTRY == 'Norfolk Island' ? ' selected="selected"' : '' ;?> value="Norfolk Island">Norfolk Island</option>
    <option<?=$ADDRESS_COUNTRY == 'Northern Mariana Islands' ? ' selected="selected"' : '' ;?> value="Northern Mariana Islands">Northern Mariana Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Norway' ? ' selected="selected"' : '' ;?> value="Norway">Norway</option>
    <option<?=$ADDRESS_COUNTRY == 'Oman' ? ' selected="selected"' : '' ;?> value="Oman">Oman</option>
    <option<?=$ADDRESS_COUNTRY == 'Pakistan' ? ' selected="selected"' : '' ;?> value="Pakistan">Pakistan</option>
    <option<?=$ADDRESS_COUNTRY == 'Palau' ? ' selected="selected"' : '' ;?> value="Palau">Palau</option>
    <option<?=$ADDRESS_COUNTRY == 'Panama' ? ' selected="selected"' : '' ;?> value="Panama">Panama</option>
    <option<?=$ADDRESS_COUNTRY == 'Papua New Guinea' ? ' selected="selected"' : '' ;?> value="Papua New Guinea">Papua New Guinea</option>
    <option<?=$ADDRESS_COUNTRY == 'Paraguay' ? ' selected="selected"' : '' ;?> value="Paraguay">Paraguay</option>
    <option<?=$ADDRESS_COUNTRY == 'Peru' ? ' selected="selected"' : '' ;?> value="Peru">Peru</option>
    <option<?=$ADDRESS_COUNTRY == 'Philippines' ? ' selected="selected"' : '' ;?> value="Philippines">Philippines</option>
    <option<?=$ADDRESS_COUNTRY == 'Pitcairn' ? ' selected="selected"' : '' ;?> value="Pitcairn">Pitcairn</option>
    <option<?=$ADDRESS_COUNTRY == 'Poland' ? ' selected="selected"' : '' ;?> value="Poland">Poland</option>
    <option<?=$ADDRESS_COUNTRY == 'Portugal' ? ' selected="selected"' : '' ;?> value="Portugal">Portugal</option>
    <option<?=$ADDRESS_COUNTRY == 'Puerto Rico' ? ' selected="selected"' : '' ;?> value="Puerto Rico">Puerto Rico</option>
    <option<?=$ADDRESS_COUNTRY == 'Qatar' ? ' selected="selected"' : '' ;?> value="Qatar">Qatar</option>
    <option<?=$ADDRESS_COUNTRY == 'Reunion' ? ' selected="selected"' : '' ;?> value="Reunion">Reunion</option>
    <option<?=$ADDRESS_COUNTRY == 'Romania' ? ' selected="selected"' : '' ;?> value="Romania">Romania</option>
    <option<?=$ADDRESS_COUNTRY == 'Russian Federation' ? ' selected="selected"' : '' ;?> value="Russian Federation">Russian Federation</option>
    <option<?=$ADDRESS_COUNTRY == 'Rwanda' ? ' selected="selected"' : '' ;?> value="Rwanda">Rwanda</option>
    <option<?=$ADDRESS_COUNTRY == 'Saint Helena' ? ' selected="selected"' : '' ;?> value="Saint Helena">Saint Helena</option>
    <option<?=$ADDRESS_COUNTRY == 'Saint Kitts and Nevis' ? ' selected="selected"' : '' ;?> value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
    <option<?=$ADDRESS_COUNTRY == 'Saint Lucia' ? ' selected="selected"' : '' ;?> value="Saint Lucia">Saint Lucia</option>
    <option<?=$ADDRESS_COUNTRY == 'Saint Pierre and Miquelon' ? ' selected="selected"' : '' ;?> value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
    <option<?=$ADDRESS_COUNTRY == 'Saint Vincent and The Grenadines' ? ' selected="selected"' : '' ;?> value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
    <option<?=$ADDRESS_COUNTRY == 'Samoa' ? ' selected="selected"' : '' ;?> value="Samoa">Samoa</option>
    <option<?=$ADDRESS_COUNTRY == 'San Marino' ? ' selected="selected"' : '' ;?> value="San Marino">San Marino</option>
    <option<?=$ADDRESS_COUNTRY == 'Sao Tome and Principe' ? ' selected="selected"' : '' ;?> value="Sao Tome and Principe">Sao Tome and Principe</option>
    <option<?=$ADDRESS_COUNTRY == 'Saudi Arabia' ? ' selected="selected"' : '' ;?> value="Saudi Arabia">Saudi Arabia</option>
    <option<?=$ADDRESS_COUNTRY == 'Senegal' ? ' selected="selected"' : '' ;?> value="Senegal">Senegal</option>
    <option<?=$ADDRESS_COUNTRY == 'Serbia' ? ' selected="selected"' : '' ;?> value="Serbia">Serbia</option>
    <option<?=$ADDRESS_COUNTRY == 'Seychelles' ? ' selected="selected"' : '' ;?> value="Seychelles">Seychelles</option>
    <option<?=$ADDRESS_COUNTRY == 'Sierra Leone' ? ' selected="selected"' : '' ;?> value="Sierra Leone">Sierra Leone</option>
    <option<?=$ADDRESS_COUNTRY == 'Singapore' ? ' selected="selected"' : '' ;?> value="Singapore">Singapore</option>
    <option<?=$ADDRESS_COUNTRY == 'Slovakia' ? ' selected="selected"' : '' ;?> value="Slovakia">Slovakia</option>
    <option<?=$ADDRESS_COUNTRY == 'Slovenia' ? ' selected="selected"' : '' ;?> value="Slovenia">Slovenia</option>
    <option<?=$ADDRESS_COUNTRY == 'Solomon Islands' ? ' selected="selected"' : '' ;?> value="Solomon Islands">Solomon Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Somalia' ? ' selected="selected"' : '' ;?> value="Somalia">Somalia</option>
    <option<?=$ADDRESS_COUNTRY == 'South Africa' ? ' selected="selected"' : '' ;?> value="South Africa">South Africa</option>
    <option<?=$ADDRESS_COUNTRY == 'South Georgia and The South Sandwich Islands' ? ' selected="selected"' : '' ;?> value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Spain' ? ' selected="selected"' : '' ;?> value="Spain">Spain</option>
    <option<?=$ADDRESS_COUNTRY == 'Sri Lanka' ? ' selected="selected"' : '' ;?> value="Sri Lanka">Sri Lanka</option>
    <option<?=$ADDRESS_COUNTRY == 'Sudan' ? ' selected="selected"' : '' ;?> value="Sudan">Sudan</option>
    <option<?=$ADDRESS_COUNTRY == 'Suriname' ? ' selected="selected"' : '' ;?> value="Suriname">Suriname</option>
    <option<?=$ADDRESS_COUNTRY == 'Svalbard and Jan Mayen' ? ' selected="selected"' : '' ;?> value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
    <option<?=$ADDRESS_COUNTRY == 'Swaziland' ? ' selected="selected"' : '' ;?> value="Swaziland">Swaziland</option>
    <option<?=$ADDRESS_COUNTRY == 'Sweden' ? ' selected="selected"' : '' ;?> value="Sweden">Sweden</option>
    <option<?=$ADDRESS_COUNTRY == 'Switzerland' ? ' selected="selected"' : '' ;?> value="Switzerland">Switzerland</option>
    <option<?=$ADDRESS_COUNTRY == 'Syrian Arab Republic' ? ' selected="selected"' : '' ;?> value="Syrian Arab Republic">Syrian Arab Republic</option>
    <option<?=$ADDRESS_COUNTRY == 'Taiwan, Province of China' ? ' selected="selected"' : '' ;?> value="Taiwan, Province of China">Taiwan, Province of China</option>
    <option<?=$ADDRESS_COUNTRY == 'Tajikistan' ? ' selected="selected"' : '' ;?> value="Tajikistan">Tajikistan</option>
    <option<?=$ADDRESS_COUNTRY == 'Tanzania, United Republic of' ? ' selected="selected"' : '' ;?> value="Tanzania, United Republic of">Tanzania, United Republic of</option>
    <option<?=$ADDRESS_COUNTRY == 'Thailand' ? ' selected="selected"' : '' ;?> value="Thailand">Thailand</option>
    <option<?=$ADDRESS_COUNTRY == 'Timor-leste' ? ' selected="selected"' : '' ;?> value="Timor-leste">Timor-leste</option>
    <option<?=$ADDRESS_COUNTRY == 'Togo' ? ' selected="selected"' : '' ;?> value="Togo">Togo</option>
    <option<?=$ADDRESS_COUNTRY == 'Tokelau' ? ' selected="selected"' : '' ;?> value="Tokelau">Tokelau</option>
    <option<?=$ADDRESS_COUNTRY == 'Tonga' ? ' selected="selected"' : '' ;?> value="Tonga">Tonga</option>
    <option<?=$ADDRESS_COUNTRY == 'Trinidad and Tobago' ? ' selected="selected"' : '' ;?> value="Trinidad and Tobago">Trinidad and Tobago</option>
    <option<?=$ADDRESS_COUNTRY == 'Tunisia' ? ' selected="selected"' : '' ;?> value="Tunisia">Tunisia</option>
    <option<?=$ADDRESS_COUNTRY == 'Turkey' ? ' selected="selected"' : '' ;?> value="Turkey">Turkey</option>
    <option<?=$ADDRESS_COUNTRY == 'Turkmenistan' ? ' selected="selected"' : '' ;?> value="Turkmenistan">Turkmenistan</option>
    <option<?=$ADDRESS_COUNTRY == 'Turks and Caicos Islands' ? ' selected="selected"' : '' ;?> value="Turks and Caicos Islands">Turks and Caicos Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Tuvalu' ? ' selected="selected"' : '' ;?> value="Tuvalu">Tuvalu</option>
    <option<?=$ADDRESS_COUNTRY == 'Uganda' ? ' selected="selected"' : '' ;?> value="Uganda">Uganda</option>
    <option<?=$ADDRESS_COUNTRY == 'Ukraine' ? ' selected="selected"' : '' ;?> value="Ukraine">Ukraine</option>
    <option<?=$ADDRESS_COUNTRY == 'United Arab Emirates' ? ' selected="selected"' : '' ;?> value="United Arab Emirates">United Arab Emirates</option>
    <option<?=$ADDRESS_COUNTRY == 'United Kingdom' ? ' selected="selected"' : '' ;?> value="United Kingdom">United Kingdom</option>
    <option<?=$ADDRESS_COUNTRY == 'United States' ? ' selected="selected"' : '' ;?> value="United States">United States</option>
    <option<?=$ADDRESS_COUNTRY == 'United States Minor Outlying Islands' ? ' selected="selected"' : '' ;?> value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
    <option<?=$ADDRESS_COUNTRY == 'Uruguay' ? ' selected="selected"' : '' ;?> value="Uruguay">Uruguay</option>
    <option<?=$ADDRESS_COUNTRY == 'Uzbekistan' ? ' selected="selected"' : '' ;?> value="Uzbekistan">Uzbekistan</option>
    <option<?=$ADDRESS_COUNTRY == 'Vanuatu' ? ' selected="selected"' : '' ;?> value="Vanuatu">Vanuatu</option>
    <option<?=$ADDRESS_COUNTRY == 'Venezuela' ? ' selected="selected"' : '' ;?> value="Venezuela">Venezuela</option>
    <option<?=$ADDRESS_COUNTRY == 'Viet Nam' ? ' selected="selected"' : '' ;?> value="Viet Nam">Viet Nam</option>
    <option<?=$ADDRESS_COUNTRY == 'Virgin Islands, British' ? ' selected="selected"' : '' ;?> value="Virgin Islands, British">Virgin Islands, British</option>
    <option<?=$ADDRESS_COUNTRY == 'Virgin Islands, U.S.' ? ' selected="selected"' : '' ;?> value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>

</select>

2 个答案:

答案 0 :(得分:3)

使用数组存储国家/地区列表。您可以将此列表存储在外部文件中,并将include存储在您需要的任何位置。

您还可以将此国家/地区列表存储在数据库的表格中(如果有)。

$countries = array(
    "Afghanistan",
    "Aland Islands",
    "Albania",
    "Algeria",
    "American Samoa",
    "Andorra",
    "Angola",
    "Anguilla",
    "Antarctica",
    "Antigua and Barbuda",
    "Argentina",
    "Armenia",
    "Aruba",
    "Australia",
    "Austria",
    "Azerbaijan",
    "Bahamas",
    "Bahrain",
    "Bangladesh",
    "Barbados",
    "Belarus",
    "Belgium",
    "Belize",
    "Benin",
    "Bermuda",
    "Bhutan",
    "Bolivia",
    "Bosnia and Herzegovina",
    "Botswana",
    "Bouvet Island",
    "Brazil",
    "British Indian Ocean Territory",
    "Brunei Darussalam",
    "Bulgaria",
    "Burkina Faso",
    "Burundi",
    "Cambodia",
    "Cameroon",
    "Canada",
    "Cape Verde",
    "Cayman Islands",
    "Central African Republic",
    "Chad",
    "Chile",
    "China",
    "Christmas Island",
    "Cocos (Keeling) Islands",
    "Colombia",
    "Comoros",
    "Congo",
    "Congo, The Democratic Republic of The",
    "Cook Islands",
    "Costa Rica",
    "Cote Divoire",
    "Croatia",
    "Cuba",
    "Cyprus",
    "Czech Republic",
    "Denmark",
    "Djibouti",
    "Dominica",
    "Dominican Republic",
    "Ecuador",
    "Egypt",
    "El Salvador",
    "Equatorial Guinea",
    "Eritrea",
    "Estonia",
    "Ethiopia",
    "Falkland Islands (Malvinas)",
    "Faroe Islands",
    "Fiji",
    "Finland",
    "France",
    "French Guiana",
    "French Polynesia",
    "French Southern Territories",
    "Gabon",
    "Gambia",
    "Georgia",
    "Germany",
    "Ghana",
    "Gibraltar",
    "Greece",
    "Greenland",
    "Grenada",
    "Guadeloupe",
    "Guam",
    "Guatemala",
    "Guernsey",
    "Guinea",
    "Guinea-bissau",
    "Guyana",
    "Haiti",
    "Heard Island and Mcdonald Islands",
    "Holy See (Vatican City State)",
    "Honduras",
    "Hong Kong",
    "Hungary",
    "Iceland",
    "India",
    "Indonesia",
    "Iran",
    "Iraq",
    "Ireland",
    "Isle of Man",
    "Israel",
    "Italy",
    "Jamaica",
    "Japan",
    "Jersey",
    "Jordan",
    "Kazakhstan",
    "Kenya",
    "Kiribati",
    "Korea, Democratic Peoples Republic of",
    "Korea, Republic of",
    "Kuwait",
    "Kyrgyzstan",
    "Lao Peoples Democratic Republic",
    "Latvia",
    "Lebanon",
    "Lesotho",
    "Liberia",
    "Libyan Arab Jamahiriya",
    "Liechtenstein",
    "Lithuania",
    "Luxembourg",
    "Macao",
    "Macedonia, The Former Yugoslav Republic of",
    "Madagascar",
    "Malawi",
    "Malaysia",
    "Maldives",
    "Mali",
    "Malta",
    "Marshall Islands",
    "Martinique",
    "Mauritania",
    "Mauritius",
    "Mayotte",
    "Mexico",
    "Micronesia, Federated States of",
    "Moldova, Republic of",
    "Monaco",
    "Mongolia",
    "Montenegro",
    "Montserrat",
    "Morocco",
    "Mozambique",
    "Myanmar",
    "Namibia",
    "Nauru",
    "Nepal",
    "Netherlands",
    "Netherlands Antilles",
    "New Caledonia",
    "New Zealand",
    "Nicaragua",
    "Niger",
    "Nigeria",
    "Niue",
    "Norfolk Island",
    "Northern Mariana Islands",
    "Norway",
    "Oman",
    "Pakistan",
    "Palau",
    "Panama",
    "Papua New Guinea",
    "Paraguay",
    "Peru",
    "Philippines",
    "Pitcairn",
    "Poland",
    "Portugal",
    "Puerto Rico",
    "Qatar",
    "Reunion",
    "Romania",
    "Russian Federation",
    "Rwanda",
    "Saint Helena",
    "Saint Kitts and Nevis",
    "Saint Lucia",
    "Saint Pierre and Miquelon",
    "Saint Vincent and The Grenadines",
    "Samoa",
    "San Marino",
    "Sao Tome and Principe",
    "Saudi Arabia",
    "Senegal",
    "Serbia",
    "Seychelles",
    "Sierra Leone",
    "Singapore",
    "Slovakia",
    "Slovenia",
    "Solomon Islands",
    "Somalia",
    "South Africa",
    "South Georgia and The South Sandwich Islands",
    "Spain",
    "Sri Lanka",
    "Sudan",
    "Suriname",
    "Svalbard and Jan Mayen",
    "Swaziland",
    "Sweden",
    "Switzerland",
    "Syrian Arab Republic",
    "Taiwan, Province of China",
    "Tajikistan",
    "Tanzania, United Republic of",
    "Thailand",
    "Timor-leste",
    "Togo",
    "Tokelau",
    "Tonga",
    "Trinidad and Tobago",
    "Tunisia",
    "Turkey",
    "Turkmenistan",
    "Turks and Caicos Islands",
    "Tuvalu",
    "Uganda",
    "Ukraine",
    "United Arab Emirates",
    "United Kingdom",
    "United States",
    "United States Minor Outlying Islands",
    "Uruguay",
    "Uzbekistan",
    "Vanuatu",
    "Venezuela",
    "Viet Nam",
    "Virgin Islands, British",
    "Virgin Islands, U.S."
);

然后,使用这一组国家/地区,打印它们并检查是否使用for循环选择了每个国家:

echo '<select class="textbox-fixed-noimage" name="ADDRESS_COUNTRY">';
foreach ($countries as $country) {
    $selected = $ADDRESS_COUNTRY == $country ? ' selected="selected"' : '';
    echo "<option {$selected} value=\"{$country}\">{$country}</option>";
}
echo '</select>';

答案 1 :(得分:0)

制作一系列国家/地区并使用foreach通过数组提取。等,

 $countries = array("USA","UA","CHINA","JAPAN");
 echo "<select>";
 foreach($countries as $country)
  {
    echo "<option>".$country."</option>";
  }
  echo "</select>";