I have a list of checkboxes with weekdays name and those values are [1,2,4,8,16,32,64]
<label class="m-checkbox">
<input type="checkbox" name="selected_days[]" value="1" id="check_sun"/>Sunday<span></span>
</label>
<label class="m-checkbox">
<input type="checkbox" name="selected_days[]" value="2" id="check_mon"/>Monday<span></span>
</label>
<label class="m-checkbox">
<input type="checkbox" name="selected_days[]" value="4" id="check_tue"/>Tuesday<span></span>
</label>
<label class="m-checkbox">
<input type="checkbox" name="selected_days[]" value="8" id="check_wed"/>Wednesday<span></span>
</label>
<label class="m-checkbox">
<input type="checkbox" name="selected_days[]" value="16" id="check_thu"/>Thursday<span></span>
</label>
<label class="m-checkbox">
<input type="checkbox" name="selected_days[]" value="32" id="check_fri"/> Friday<span></span>
</label>
<label class="m-checkbox">
<input type="checkbox" name="selected_days[]" value="64" id="check_sat"/> Saturday<span></span>
</label>
While saving them I make a sum of selected checkboxes to store in DB
<?php array_sum($post_data["selected_days"]);?>
So the problem is while getting the day I get some of the select checkboxes right. I am unable to find how to display selected checkboxes with the sum
Ex: Mon, Tue and Sat selected So the DB value will be 70 (2+4+64) When I get from DB it will be 70. How do I know those are Mon, Tue & Sat only
Please help me to do it