TecTao Posted October 9, 2014 Share Posted October 9, 2014 I posted a topic earlier and there was confusion as to what I could not work out. I am able to display the checkbox, either checked or unchecked depending of the value or 1 or 0 in the obcDisplay field. <input type="checkbox" name="obcDisplay" value="<?=$r['obcDisplay'] ?>" <?=($r['obcDisplay']) ? 'checked="checked"' : ''; ?>/> I am trying to update the DB table by the checkbox. If the checkbox is checked (obcDisplay = 1) and I uncheck the box and submit, I want the table updated so that obcDisplay now equals 0. When the form is displayed, the checkbox is now uncheck (obcDisplay = 0). Now I check the box and submit and the update changes the field from 0 to 1. I can display the checkbox as checked or unchecked by the DB field obcDisplay being either 0 or 1. It is changing the value where I am having the problem. Link to comment https://forums.phpfreaks.com/topic/291521-linking-checkbox-value-to-a-table-record-in-php-and-changing-values/ Share on other sites More sharing options...
mac_gyver Posted October 9, 2014 Share Posted October 9, 2014 you received a reply in your other thread that explains how to test for a checked (and not checked) checkbox. Link to comment https://forums.phpfreaks.com/topic/291521-linking-checkbox-value-to-a-table-record-in-php-and-changing-values/#findComment-1493136 Share on other sites More sharing options...
Recommended Posts