2017-03-02 89 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

檢查我的答案已更新。 –