Child records needing the ID

Hi

I was hoping someone would be able to help me with a bit of a problem.
So far I’ve been doing well with my first project. However, I’ve come
across a dilemma.

I have a system where I create a record and this then loads a secondary
form (using Ajax) for the entry of the child elements.

For example: I enter details of the “Family” table and click submit at
which point the form for entering the members of that family (the child
table).

However, when submitting the final table I get an error declaring that I
am missing the ID that links to the two tables. Its complaining because
it hasn’t got the parent ID to put into the child to ‘link’ the two.

How do I insert the ID of the recently created parent record into the
child record?

I’d be very grateful for any advice.

Kind regards

Doug