create function to edit record in table