You can use the Manager Relational Table server behavior to insert into a third joining table to record relationships between two other tables.
If you want to make use of the id of the inserted record you can configure this within the insert, you can specify what the key column is and what to store it as in a session variable. One the record is inserted you will have access to this session variable that you can use on the next page or any page after.
As far as having step by step instructions for the MRT server behavior here is a post that lists the steps you can take to get this implemented into pages.
showpost.php?p=10544&postcount=3