if the user changes the employeeID to a hidden field, the wrong employee will be updated in the database
This is a serious security hole on your website. In everything you do with web development, no matter how smart some kind of code can be or how much you think you'll be fine as long as users donโt do anything, remember one golden rule: never imply data trust received from the customer.
To change anything on his website, the user must be logged in. (Is that right?) Therefore, in any attempt, the user makes to submit the form to the website (especially the one that can modify the data), double check that the user submitting the form has permission to perform the requested action on the specified data.
Ideally, every action that is not fully public and unsecured should have a server-side rights check. Never, never trust what the customer sends you.
David source share