Is It Possible To Insert Records Into Multiple Tables?

In the Server Actions, can I insert data to multiple tables. If so, here’s a rough example of the steps I have in mind:

All of the following would be displayed on the same page.

Using the Server Actions to setup a personnel database with several tables the hold unique data relative to an individual.

Here’s my sketch with the Action Steps…

Action Step 1. Insert a person’s contact information into the contact table with the contact insert form.

Action Step 2. Query the contactID from the previous insert and use it to hide the previous contact form, show the next address insert form, and use the contactID as a foreign key to link the next table.

Action Step 3. Insert a person’s address to the address table with an insert address form, using the previous contactID as a foreign key. Likewise use this addressID to hide this form and show the next form, etc.

Continue this pattern until all the tables related this person’s record.

Is this possible? Or am I dreaming?

Community Page
Last updated: