【发布时间】:2021-08-24 19:12:55
【问题描述】:
<?php foreach($isi as $u){ ?>
<div>
<input type="radio" class="btn-check" name="status_pendaftaran" value="1" <?php echo $u->status_pendaftaran=="1" ? 'checked' : ''; ?> id="buka" autocomplete="off">
<label class="btn btn-outline-success" for="status_pendaftaran">Pendaftaran dibuka</label>
<input type="radio" class="btn-check" name="status_pendaftaran" value="2" <?php echo $u->status_pendaftaran=="2" ? 'checked' : ''; ?> id="tutup" autocomplete="off">
<label class="btn btn-outline-danger" for="status_pendaftaran">Pendaftaran ditutup</label>
</div>
<?php }?>
我的代码的问题是我无法将按钮从value="1" 切换到value="2"。
如果数据库上的值为 1,它将卡在value="1"。我无法切换到value"2"。
单选按钮不允许我这样做。它卡住了,阻止我使用页面上的按钮将我的数据库更新为 value="2"。
【问题讨论】:
标签: php html radio-button radio