为了账号安全,请及时绑定邮箱和手机立即绑定

将多个复选框值存储到 php mysqli 数据库中

将多个复选框值存储到 php mysqli 数据库中

慕田峪4524236 2022-12-22 09:43:21
抱歉,如果我要问的是一个愚蠢的问题,但我一直在阅读并尝试可用的代码,但它们都不起作用。这是我了解存储多个复选框值的链接如何插入多个复选框值在数据库中添加多个复选框值Mysqli-PHP 将多个复选框值存储到一条记录中我有一个带有多个复选框的表单,我需要将值存储到数据库中。我现在的问题是它一直弹出这个错误解析错误:语法错误,意外的“$chk”(T_VARIABLE),期待“)”下面是我的代码notification_form.php<div class="form-group row">  <label class="col-md-2 col-form-label">Potential Escalation: </label>  <div class="col-md-5">    <input type="checkbox" id="potential_escalation[]" value="Under control with available resources. No potential of escalation" />&nbsp;<text>Under control with available resources. No potential of escalation.</text>  </div>  <div class="col-md-5">    <input type="checkbox" id="potential_escalation[]" value="May requires additional resources (e.g. authorities, contractors, mutual aid groups)." />&nbsp;<text>May requires additional resources (e.g. authorities, contractors, mutual aid groups).</text>  </div></div><div class="form-group row">  <label class="col-md-2 col-form-label"></label>  <div class="col-md-5">    <input type="checkbox" id="potential_escalation[]" value="Authorities may take over command and control" />&nbsp;<text>Authorities may take over command and control.</text>  </div>  <div class="col-md-5">    <input type="checkbox" id="potential_escalation[]" value="May triggers significants authorities/ public community/ media interest." />&nbsp;<text>May triggers significants authorities/ public community/ media interest.</text>  </div></div>
查看完整描述

1 回答

?
白衣染霜花

TA贡献1796条经验 获得超10个赞

$checkbox1 = mysqli_real_escape_string($conn, $_POST['potential_escalation'] <-- 你错过了结束圆圈);



查看完整回答
反对 回复 2022-12-22
  • 1 回答
  • 0 关注
  • 89 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信