Unchecking Selected Checkboxes in PHP ?

Hello,

First of all, I am VERY new at using PHP, so please bear with me. I have a PHP page that I created for tracking attendance for hockey coaches, for a summer hockey program that I run. The data on the page (the coaching data) is pulled from a MySQL database. Next to the Coaches names in the table, there are a series of columns with checkboxes. The coach will check the checkbox for all of the dates that he/she can work. I have this working fine. Checkbox selected, form submits, and it updates the database.

But, here is the part I absolutely cannot figure out. What if a coach decides he/she cannot work on a day they had already selected ? How to they uncheck a particular checkbox, post the form, and have the corresponding record(s) in the database updated. From what I understand, unchecked checkboxes have empty values, so they do not get posted ?

Here is the page I am working with.

If you look at the July 4th column, you will notice several checkboxes are checked. I would like to be able to unselect 1 or more of these, and have the corresponding records updated.

If anyone can provide help, it would be much appreciated.

Thank you.

One possibiliy is to use an if statement. If isset, yes else no. The issue I see you may have, is dependent on how you set your data table. Would it update or add a new record? Are the dates coming from a separate table than the coaches info?

[I removed the link you posted. I don’t think the coaches would like the personal information shared.]

Sponsor our Newsletter | Privacy Policy | Terms of Service