add the following code after the first insert and before the second one:
<?php if((!isset($_POST["newTitle"]) || $_POST["newTitle"] == "") && (isset($_POST['CourseTitleID']) && $_POST['CourseTitleID'] != "")) $_SESSION['WADA_Insert_coursetitle'] = $_POST['CourseTitleID']; ?>