Dynamically getting tags in post edit screen

I know this is but a patch, but i followed WebElaine advise and hooked my function to the “save_post” hook.
As I wanted my plugin to be used while editing the post, I have added button to update the tags that actually saves the post.

error code: 523