且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用foreach循环,jquery和ajax插入多个复选框值

更新时间:2023-10-15 08:41:16

对您***的建议是,如果某些方法无法按您希望的方式工作,则应检查每一步会发生什么,直到发现问题为止.这不仅适用于此问题,还适用于任何编程问题(以及许多其他问题).

The best advice for you is that if something doesn't work the way you want, you should examine what happens at each step until you find the problem. This doesn't only apply to this question, but to any programming problem (and many others).

在这种情况下

  • 从浏览器发送的数据是否正确?您已经有语句console.log(rubricChkbox);.您检查了该值吗?您为什么不将其包含在问题中?
  • 正确的数据是否到达PHP脚本?使用类似print_r ($_POST);的东西.
  • SQL INSERT取决于SQL SELECT的结果.您是否检查过这种情况是否成立,否则您的代码甚至都不会尝试插入.
  • INSERT语句返回一些错误吗?
  • Is the data sent from the browser correct? You already have the statement console.log(rubricChkbox);. Did you check that value? Why didn't you include it in the the question?
  • Does the correct data arrive at the PHP script? Use something like print_r ($_POST);.
  • The SQL INSERT depends on the result of a SQL SELECT. Did you check that this condition is true, because otherwise your code wont even try to insert.
  • Does the INSERT statement return some error?