added new function to check check the value of checkbox and update database