チェックボックスのフォーム送信がうまくいかない場合の対処法

スポンサーリンク

PHPを使ってのチェックボックスのフォーム送信がうまくいかない場合の対処法です。

案外苦戦したので自分メモ。

やりたかった手順は以下の通り。
JavaScriptを使っています。

  1. MySQLからデータ(0か1のBoolean型)を取得。
  2. そのデータを素にHTMLフォームのチェックボックスへ反映。
  3. そのチェックボックスをオン・オフした後フォーム送信し、MySQLへデータへ書き込む。
(..手順1..ごにょごにょ)

<?php $chk_value = $result['closed_flag'] ? 1 : 0; ?>
<input type="hidden" name="closed_flag" value="<?=$chk_value;?>">
<input type="checkbox" onclick="this.form.close_flag.value=this.checked ? 1 : 0" <?php if($chk_value){echo 'checked';} ?>

(..手順3..もぎょもぎょ)

※上のソースコードは、手順2のみ記載してあります。

コメント

rtp live

rtp slot

slot bet 200

bonus new member

rtp slot gacor

situs slot777

joker123

idn poker

situs joker123

rtp

slot bet kecil

slot bonus

depo 25 bonus 25

baccarat online

slot server thailand

sbobet

slot garansi kekalahan

slot bonus new member

sbobet88

slot bonus

slot777 gacor

situs slot bet kecil

slot777

slot bonus new member 100

slot777 gacor

rtp slot gacor hari ini

slot bet

slot88

slot88 resmi

slot gacor hari ini

slot777 login

slot88

slot gampang maxwin

rtp slot tertinggi

starlight princess

bonus new member

wisdom of athena

mochimon

slot 200

slot bet 200

slot777 online

slot777 gacor

jurrasic kingdom

sugar rush

aztec gems

bonus new member

mahjong ways

bonus new member 100

caishen wins

caishen wins slot

slot777 gacor

tree of riches slot

aztec slot

lucky neko slot

rtp slot

slot gacor

slot88 resmi

situs slot

https://slotbonus.softcia.com.br

https://slotbonus.deparmotor.com/

bonus new member

slot777

rtp slot

slot 777

bonus new member

https://adresa-telefony.ru/img/slot777/

https://adresa-telefony.ru/img/joker123/

https://adresa-telefony.ru/img/sbobet/

https://rtp-slot.nwbc.com.au/

https://realesaletter.com/js/sbobet/

https://realesaletter.com/js/slot777/

https://www.yg-moto.com/wp-includes/bet-kecil/

https://pri-israel.com/wp-includes/bet-kecil/

https://www.contato10.com.br/wp-includes/slot-bet-kecil/

https://copima.jp/latex/bet-100/

https://www.routlens.lu/app/themes/bet-100/

https://aws-klinkier.pl/wp-content/bet-100/

https://esigarauzmani.org/wp-includes/slot-bet-kecil/

https://www.bonus-new-member.albedonekretnine.hr/

slot bet 100

slot bet 100

slot bet 100

タイトルとURLをコピーしました