6 – Comparison of before and after state in "what_submit" ($ form, & $ form_state)

In a custom module, I have a form that allows some data to create, update, and delete in a specific table in the database.
In the submit part of the code I want the status & # 39; before & # 39; (which was displayed to the user) with status & # 39; after & # 39; (which he actually entered) to properly update the database: create what has been added, update what has been changed, and delete what has been removed.
How can I do that?
By the way, Drupal 6.37 is running on the site.