php - how to pick a country dropdown selection form item without using database? -


"postprint" itemprop = "text">

I have used this PHP code that I have used to select a dropdown form of the country, although I have to query this additional mysql I want to finish and just page however I do not use the query if I choose those countries, then please get advice on getting the data to be lost

  To store in-house production like; Choose name = "country" style = "width: 180 pixels;" Onchange = "do_get_rest_popup (this.value)" o & gt; & Lt ;? PHP $ sql = "Select * Url from country countries ORDER"; $ Result_country = Execution ($ sql); While ($ line_country = mysql_fetch_array ($ result_country)) {$ db_country_id = $ line_country ['id']; $ Country_name = $ line_country ['country']; ? & Gt; & Lt; Option value = "& lt;? = $ Db_country_id?" & Lt;? If ($ line_member ['country'] == $ db_country_id) {echo "selected";} & gt; & Gt; & Lt ;? = $ COUNTRY_NAME & gt; & Lt; / Options & gt; By & lt;? }? & Gt; & Lt; / Select & gt;  

Code Output On this page, I post this

  about the amount of countries STRUNK is about; Select name = "country" style = "width: 180px;" onchange = "do_get_rest_popup (this.value)" o & gt; & Lt; Option value = "217" & gt; Turkmenistan & lt; / Options & gt; & Lt; Option value = "218" & gt; Turks and Caicos Islands & lt; / Options & gt; & Lt; Option value = "21 9" & gt; Tuvalu & lt; / Option & gt; & Lt; Option value = "220" & gt; Uganda & lt; / Option & gt; & Lt; Option value = "221" & gt; Ukraine & lt; / Options & gt; & Lt; Option value = "222" & gt; United Arab Emirates & lt; / Options & gt; & Lt; Option value = "223" & gt; United Kingdom (Great Britain) & lt; / Options & gt; & Lt; Option value = "224" SELECTED> United States & lt; / Options & gt; & Lt; / Select & gt;  

How about something like this?

  & lt;? $ Countries = array ("217" = & gt; "Turkistan", "218" => "Turks and Caicos Islands", "219" => 
"Tuvalu", "220" => "Uganda "," 221 "= & gt;" Ukraine "," 222 "= & gt;" United Arab Emirates "," 223 "=>" United Kingdom (Great Britain) "" 224 "= & gt;" Combined State of America "); ? & Gt; & Lt; Select name = "country" style = "width: 180px;" Onchange = "do_get_rest_popup (this.value)" /> & Lt ;? Php $ countryCounter = 1; $ AmtOfCountries = Count ($ country); Foreign currency ($ country id => $ c) {if ($ countryCounter == $ amtOfCountries) {echo "option" value = \ "$ id \" SELECTED> $ c & lt; / option & Gt; "; } Else {echo "

Edit: I did not test it but you should get this idea


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -