2017-03-02 90 views
0

我有了多份此HTML代码作为用户想虽然一个按钮,增加了另一个设置如何保存未经检查的动态复选框数组?

<input type="email" class="regular-text" id="customer_email_address[]" name="customer_email_address[]" placeholder="Email Address" /> 
<input type="text" class="regular-text" id="customer_email_password[]" name="customer_email_password[]" placeholder="Password" /> 
<input type="checkbox" id="customer_email_create[]" name="customer_email_create[]" /> 

我的问题是,虽然我可以保存与PHP选中的复选框,我不能确定哪些未被选中。

我该如何去做这样的事情?

+0

在JS或表单提交? – clearshot66

+0

post form submit –

+0

尝试这里建议的内容 http://stackoverflow.com/questions/1809494/post-the-checkboxes-that-are-unchecked – clearshot66

回答

0

例如,您可以检查customer_email_create值。如果它是空的,复选框被取消选中。

编辑:

由于值是数组,每个数据更新,您必须删除数据库相关的所有数据,并从POST请求添加新的数据。

+0

问题是,这是这3个字段的数组。如果其中一个选中,我可以检查,但我无法知道它连接到哪一组输入。 –

+0

检查我的答案已更新。 –