Using checkbox to update existing boolean (yes/no)

Hi all, I am currently working to make use of a checkbox to update an existing boolean in my database table.

I used the below link to create the checkboxes

Link below is my current code

My goal is that when i check the checkbox, the 'selection' boolean is set to 'yes', if it is unchecked, the 'selection' boolean is set to 'no'. However, I have no idea where to implement it in the above code.

Do reply if you need access to the app to aid me further or if you have a solution.

Thank you in advance.