I need help on how to populated data automatically Database Relations

Hi I need help guys:
I have a users table with userID and i have another products table with productID and it references users table with userID.

I want when a user enters data on the product table the userID field should be hidden and populated with the userID from the users table automatically.

Please help

You make the form without the user ID field. In your Server Action, you put a Security Identity step and then in your Database Insert step you insert the security.identity variable in the userID column.

Do not use hidden fields, they can be modified by the user and therefore untrusted

2 Likes

Thank you