Two immediate options
- Change the order of the
if
statements so they are in the order you prefer them to be checked. - or better, test the state of all checkboxes in each
if
statement; that is, don’t just test if some are checked and assume the rest are unchecked — test the unchecked checkboxes as well. Be explicit!