I have a form like this:
Code:
<form id="form1" name="form1" method="post" action="">
  <input type="checkbox" name="checkbox[]" id="checkbox[]" value="1" /> Item 1
  <input type="checkbox" name="checkbox[]" id="checkbox[]" value="2" /> Item 2
  <input type="checkbox" name="checkbox[]" id="checkbox[]" value="3" /> Item 3
  <input type="submit" name="button" id="button" value="Submit" />
</form>

When I submit (checking only the first and the third record checkboxes for example) I do a foreach and I insert only the checked records in my database:

id value_id_ck
1 1
2 3

So, when I go back to the form I see the first and the third checkboxes checked

Now, If i uncheck the 1st and the 3rd ones and check the 2nd, how to update?
How to know that a record was there and now I dont want it to be there anymore and I want to include new ones?

I´d like now my database to be
id value_id_ck
3 2