我有一個foreach循環多個複選框在我的代碼無法處理循環中未選中的複選框,同時保存
<form method='POST' action='save.php'>
<?php foreach($problems as $problem): ?>
<input type='text' name="month[]"/>
<input type="checkbox" name="is_increased[]" value="1" />
<?php endforeach; ?>
<input type='submit' value='Submit'/>
</form>
當我保存,我只拿到選中的複選框的值。 如何獲取所有複選框的值,如果取消選中複選框,它將爲'0'。 謝謝。
您可能會發現您的解決方案:http://stackoverflow.com/questions/18382979/get-check-box-value-if-checked –
謝謝。但是這個話題並沒有提供關於未經檢查的複選框的任何想法。但我需要這些未檢查的值爲'0'或false來保存。 –
您的發佈代碼不支持您未向我們顯示的「錯誤」。發佈更多相關的代碼,包括PHP。加上確保短標籤啓用'<? endforeach; ?> –