Start with the first insert. Remove the DW server behavior and use the DataAssist server behavior for inserting the record. It will automatically store the inserted id as a session variable and will ask you the name of it in the interface. This will give you a place where you can reference the session variable name and assure you that it is set properly.
Then simply try to display that session variable on the next page before using it as part of the second insert.
To the top of the page add:
<?php
session_start();
die($_SESSION['yourvariablename']);
?>
Once that can be used to display the session variable on the next page, you can use that same syntax to reference the session variable in your insert. (leave the session_start() code at the top of the page and remove the die(); line once it displays the session variable properly)