$rowTrReq = NULL;
                }
            } else {
                echo "";
            }
            echo "</td>";
            echo "</tr>";
            unset($rsSelectedPP, $num_rows_TrReq);
            $rowTr = NULL;
        }
        unset($rsTr, $rowTr);
    }
}
if ($opn == 'trnalloted_forsub') {
    if ($subdiv != '' && $subdiv != NULL) {
        $rsTr = fatch_training_type('');
        for ($k = 0; $k <= rowCount($rsTr); $k++) {
            $rowTr = getRows($rsTr);
            echo "<tr>";
            echo "<td align='left' width='30%'>" . $rowTr['training_desc'] . "</td>\n";
            echo "<td align='left'>";
            $rsTrReq = training_alloted_forsub($subdiv, $rowTr['training_code']);
            $num_rows_TrReq = rowCount($rsTrReq);
            if ($num_rows_TrReq > 0) {
                for ($i = 0; $i < $num_rows_TrReq; $i++) {
                    $rowTrReq = getRows($rsTrReq);
                    echo $rowTrReq['post_stat'] . ": " . $rowTrReq['total'] . ";&nbsp;&nbsp;";
                    $rowTrReq = NULL;
                }
            } else {
                echo "";
<tr><td align="center"><form method="post" name="form1" id="form1">
<table width="70%" class="form" cellpadding="0">
	<tr><td align="center" colspan="2"><img src="images/blank.gif" alt="" height="2px" /></td></tr>
    <tr><td height="18px" colspan="2" align="center"><?php 
print isset($msg) ? $msg : "";
?>
<span id="msg" class="error"></span></td></tr>
    <tr><td align="center" colspan="2"><img src="images/blank.gif" alt="" height="5px" /></td></tr>
    <tr><td align="left" valign="top" width="35%"><span class="error">&nbsp;&nbsp;</span>No of PP Selected</td><td align="left" id="no_pp_selected"></td></tr>
    <tr><td colspan="2"><img src="images/blank.gif" alt="" height="5px" /></td></tr>
	<tr>
	  <td align="left"><span class="error">*</span>Training Type</td>
	  <td align="left"><select name="training_type" id="training_type" style="width:200px;">
	    <option value="0">-Select Training Type-</option>
		<?php 
$rsTrainingType = fatch_training_type('');
$num_rows = rowCount($rsTrainingType);
if ($num_rows > 0) {
    for ($i = 1; $i <= 2; $i++) {
        $rowTrainingType = getRows($rsTrainingType);
        echo "<option value='{$rowTrainingType['0']}' >{$rowTrainingType['1']}</option>\n";
        $rowTrainingType = NULL;
    }
}
unset($rsTrainingType, $num_rows, $rowTrainingType);
?>
	    </select></td></tr>
    <tr>
      <td align="left"><span class="error">*</span>Subdivision</td>
      <td align="left"><select name="subdivision" id="subdivision" style="width:200px;">
    							<option value="0">-Select Subdivision-</option>