php读取数据库并显示在复选框_PHP复选框设置为基于数据库值进行检查

I have a system where people fill in their information and later can go back and edit certain parts, basically the enter personal info and check whether they want to know extra info, these bits of extra infos are checkboxes, 4 of them. the user will select up to any of the 4 and the database has 4 fields set to no, if they select one it changes to yes. I want them to be able to go back and deselect or reselect any of these 4 checkboxes, so what i want s for the checkboxes to be selected if the values is yes and unselected if the value is not.

the fields are tag_1, tag_2, tag_3, tag_4

Anyhelp greatly appreciated

I gather some kind of if statement but not sure how to involve it in a checkbox.

Tag 1

Ian

解决方案

Extract the information from the database for the checkbox fields. Next change the above example line to:

(this code assumes that you've retrieved the information for the user into an associative array called dbvalue and the DB field names match those on the HTML form)

>

If you're looking for the code to do everything for you, you've come to the wrong place.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值