插入查询后设置会话值

I am trying to set a session variable after first successful insert query. I have a javascript Confirm to check if the user wants to add more data. If user wants to add more Products then I don't have to insert into the first table so keep the session value. If not then clear out the session data. I am not sure this is is right way of doing it. Could you please let me know if there are any suggestions.

<?php                  
if ($_SERVER['REQUEST_METHOD'] == 'POST') 
{               
    session_start(); 

   if (empty($_SESSION['new_id'])) 
   {
       $first = $_POST["first"];
       $first = mysql_real_escape_string($first);
       $last = $_POST["last"];
       $last = mysql_real_escape_string($last);
       $insertsql = "INSERT INTO Table1(FirstName,LastName) VALUES ('".$first."', '" .$last. "')";              
       $result1 = mysql_query($insertsql) or die(mysql_error());
       $new_id = MySql_Insert_Id();
       $_SESSION['new_id'] = $new_id;
    }
    $prodName = $_POST["prodName"];
    $prodName = mysql_real_escape_string($prodName); 
    $prod_details = $_POST["prod_details"];
    $prod_details = mysql_real_escape_string($prod_details);
    $insertSQl2 = "INSERT INTO Table2($_SESSION['new_id'], Product_Name, Product_Details) VALUES ('".$new_id."', '" .$prodName. "', '" .$prod_details. "')";               
$Result2 = mysql_query($insertSQl2) or die(mysql_error());      
}  
?> 
<form>
  //controls here
</form>
<?php
    if($Result2 == true)
    {
    echo "Data saved Successfully";
    echo '<script type="text/javascript">'    , 'if confirm("Would like to add more Products?") '    , '</script>';
    }
?>