PHPで全国都道府県をセッションに代入してみる 都道府県をセッションに代入

PHPで全国都道府県をセッションに代入してみる 都道府県をセッションに代入

都道府県別にセッションに格納したい!
フォームで住所を聞くときとかに役立ちそう。

調べてみた。


使い方は人それぞれ。
使えたらいいね(笑)


if($_SESSION['ken']=="北海道"){$kho = 'selected="selected"';}
else if($_SESSION['ken']=="青森県"){$kao = 'selected="selected"';}
else if($_SESSION['ken']=="岩手県"){$kiwa = 'selected="selected"';}
else if($_SESSION['ken']=="宮城県"){$kmiya = 'selected="selected"';}
else if($_SESSION['ken']=="秋田県"){$kaki = 'selected="selected"';}
else if($_SESSION['ken']=="山形県"){$kyama = 'selected="selected"';}
else if($_SESSION['ken']=="福島県"){$kfukuya = 'selected="selected"';}
else if($_SESSION['ken']=="茨城県"){$kibara = 'selected="selected"';}
else if($_SESSION['ken']=="栃木県"){$ktoti = 'selected="selected"';}
else if($_SESSION['ken']=="群馬県"){$kgun = 'selected="selected"';}
else if($_SESSION['ken']=="埼玉県"){$ksai = 'selected="selected"';}
else if($_SESSION['ken']=="千葉県"){$ktiba = 'selected="selected"';}
else if($_SESSION['ken']=="東京都"){$ktou = 'selected="selected"';}
else if($_SESSION['ken']=="神奈川県"){$kkana = 'selected="selected"';}
else if($_SESSION['ken']=="新潟県"){$knii = 'selected="selected"';}
else if($_SESSION['ken']=="富山県"){$ktoya = 'selected="selected"';}
else if($_SESSION['ken']=="石川県"){$kishi = 'selected="selected"';}
else if($_SESSION['ken']=="福井県"){$kfuku = 'selected="selected"';}
else if($_SESSION['ken']=="山梨県"){$kyamana = 'selected="selected"';}
else if($_SESSION['ken']=="長野県"){$knagano = 'selected="selected"';}
else if($_SESSION['ken']=="岐阜県"){$kgifu = 'selected="selected"';}
else if($_SESSION['ken']=="静岡県"){$kshizu = 'selected="selected"';}
else if($_SESSION['ken']=="愛知県"){$kai = 'selected="selected"';}
else if($_SESSION['ken']=="三重県"){$kmie = 'selected="selected"';}
else if($_SESSION['ken']=="滋賀県"){$kshiga = 'selected="selected"';}
else if($_SESSION['ken']=="京都府"){$kkyo = 'selected="selected"';}
else if($_SESSION['ken']=="大阪府"){$koo = 'selected="selected"';}
else if($_SESSION['ken']=="兵庫県"){$khyo = 'selected="selected"';}
else if($_SESSION['ken']=="奈良県"){$knara = 'selected="selected"';}
else if($_SESSION['ken']=="和歌山県"){$kwaka = 'selected="selected"';}
else if($_SESSION['ken']=="鳥取県"){$ktoto = 'selected="selected"';}
else if($_SESSION['ken']=="島根県"){$ksima = 'selected="selected"';}
else if($_SESSION['ken']=="岡山県"){$koka = 'selected="selected"';}
else if($_SESSION['ken']=="広島県"){$khiro = 'selected="selected"';}
else if($_SESSION['ken']=="山口県"){$kyama = 'selected="selected"';}
else if($_SESSION['ken']=="徳島県"){$ktoku = 'selected="selected"';}
else if($_SESSION['ken']=="香川県"){$kkaga = 'selected="selected"';}
else if($_SESSION['ken']=="愛媛県"){$kehi = 'selected="selected"';}
else if($_SESSION['ken']=="高知県"){$kkou = 'selected="selected"';}
else if($_SESSION['ken']=="福岡県"){$kfukuo = 'selected="selected"';}
else if($_SESSION['ken']=="佐賀県"){$ksaga = 'selected="selected"';}
else if($_SESSION['ken']=="長崎県"){$knagasa = 'selected="selected"';}
else if($_SESSION['ken']=="熊本県"){$kkuma = 'selected="selected"';}
else if($_SESSION['ken']=="大分県"){$kooi = 'selected="selected"';}
else if($_SESSION['ken']=="宮崎県"){$kmiya = 'selected="selected"';}
else if($_SESSION['ken']=="鹿児島県"){$kkago = 'selected="selected"';}
else if($_SESSION['ken']=="沖縄県"){$koki = 'selected="selected"';}
関連記事


【 忘却板/忘れた事を貼れます 】

コメント

非公開コメント