I am having trouble inserting current user ID into the database using on click function.

Hello, I am wondering if there’s an easier way to do this.
I have attempted to create a new field name in the db so on the dynamic page, once the user clicks ’ adopt a family’ the users id is inserted to the ’ adopter name ’ field. However ,this didn’t really work. So , I am wondering if there’s an easier way to do this with code or without it. Its pretty urgent . Thank you!