Without looking at all the code, i can make a guess why it fails.
You retrieve field5 in the top of your plugin with a query. The database has however not been updated yet at this point, and thus still holds the old value. Only after the update has been completed the new value will be in the database.
What you should do is, is retrieve the "old" value from the database, and if not the same as the value selected on the page (ie. user made a new choice), process it based on the page value, not the current database value.
|