For simplicity you can use a multiple insert instead of manage relational table on the insert page. Manage relational table is only necessary on update pages.
Since you have already set it up, you can probably fix this issue by updating from:
$WA_masterKeyValue = "".$_SESSION['WADA_Insert_courses'] ."";
to:
$WA_masterKeyValue = "".(isset($_SESSION['WADA_Insert_courses'])?$_SESSION['WADA_Insert_courses']:"0") ."";