so the cancel button is working fine using the Insert_ID session?
onclick="document.location.href='tbl_mi_details_de tail.php?RefNo=<?php echo ((isset($_SESSION["Insert_ID"]))?$_SESSION["Insert_ID"]:""); ?>';" />
in this code, your using a form element:
tbl_mi_details_detail.php?RefNo=<?php echo ((isset($_POST["Insert_ID"]))?$_POST["Insert_ID"]:""); ?>
does that form element exist?
did you try setting the value of the Insert_ID form element to use the session variable?
<input type="hidden" name="Insert_ID" id="Insert_ID" value="<?php echo ((isset($_POST["Insert_ID"]))?$_POST["Insert_ID"]:""); ?>" />