function showMdlCol($UserType)
{
    if ($UserType == "DAO" || $UserType == "GMO" || $UserType == "HOSPITAL" || $UserType == "ADMIN") {
        getLastUrl();
        $lastUrl = $_SESSION['lastUrl'];
        $id = $_GET['caseid'];
        $result = mysql_query("SELECT hospital.name as hname, district.name as \n\t\t\tdistname, postoffice.name as pname, disease.name as dname, fatal, reportedon, \n\t\t\tdiedon, casedate, casereport.name as cname, age, sex, address1, address2, \n\t\t\tcasereport.pincode, createdon    \n\t\t\tFROM casereport\n\t\t\tLEFT JOIN district on casereport.districtid = district.districtid\n\t\t\tLEFT JOIN hospital on casereport.hospitalid = hospital.hospitalid\n\t\t\tLEFT JOIN postoffice on casereport.postofficeid = postoffice.postofficeid\n\t\t\tLEFT JOIN disease on casereport.diseaseid = disease.diseaseid\n\t\t\tWHERE casereportid='{$id}' ") or die(mysql_error());
        $row = mysql_fetch_array($result);
        echo "\t<table>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<h3> View Case Report</h3>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<table>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\t\tName of Patient\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t:\t" . $row['cname'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tAge\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['age'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tSex\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['sex'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tAddress1\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['address1'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tAddress2\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['address2'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tDistrict\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['distname'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tPost Office\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['pname'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tPincode\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['pincode'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tHospital\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\" >\n\t\t\t\t\t\t\t\t:\t" . $row['hname'] . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tDisease\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['dname'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tStatus\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . $row['fatal'] . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tReported on\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . getDateFromDb($row['reportedon']) . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tDied on\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t: ";
        if ($row['diedon'] != "") {
            echo getDateFromDb($row['diedon']);
        } else {
            echo $row['diedon'];
        }
        echo "</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tCase Date\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . getDateFromDb($row['casedate']) . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tCreated on\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t:\t" . getDateFromDb($row['createdon']) . "\n\t\t\t\t\t\t\t</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>";
        echo '<input class="backButton" type="button" value="Back" name="back"
									onclick="javascript:changeViewPage(\'' . $lastUrl . '\')" />';
        echo "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\t\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>";
    } else {
        echo '<h3>You are not Authorised to view this page</h3>';
    }
}
function showMdlCol($UserType, $flag)
{
    $arrFatal = array("Fatal", "Admitted");
    $intCount = 0;
    $Eresult = mysql_query("select * from disease") or die(mysql_error());
    while ($erow = mysql_fetch_array($Eresult)) {
        $content = $erow['name'];
        $countid = $erow['diseaseid'];
        $arrDisease[$intCount] = $content;
        $arrDiseaseId[$intCount] = $countid;
        $intCount++;
    }
    $intCount = 0;
    $Dresult = mysql_query("select * from district") or die(mysql_error());
    while ($drow = mysql_fetch_array($Dresult)) {
        $content = $drow['name'];
        $countid = $drow['districtid'];
        $arrDistrict[$intCount] = $content;
        $arrDistrictId[$intCount] = $countid;
        $intCount++;
    }
    if ($UserType == "DAO" || $UserType == "GMO" || $UserType == "ADMIN" || $UserType == "HOSPITAL") {
        getLastUrl();
        $lastUrl = $_SESSION['lastUrl'];
        $id = "";
        $arrCaseStatus = array("Admitted", "Fatal");
        $caseId = "";
        $caseName = "";
        $caseAge = "";
        $caseSex = "";
        $caseAddress1 = "";
        $caseAddress2 = "";
        $casePincode = "";
        $caseHospitalId = "";
        $caseDisease = "";
        $caseDiseaseId = "";
        $caseDistrictId = "";
        $caseFatal = "";
        $caseReportedOn = "";
        $caseDiedOn = "";
        $caseDate = "";
        $hId = "";
        $hName = "";
        if ($flag == 'false' || $flag == 'phpValidError') {
            $caseName = $_POST['txtName'];
            $caseAge = $_POST['txtAge'];
            $caseSex = $_POST['rdoSex'];
            $caseAddress1 = $_POST['txtAddress1'];
            $caseAddress2 = $_POST['txtAddress2'];
            $casePincode = $_POST['txtPincode'];
            $caseHospitalId = $_POST['cmbHospital'];
            $caseDistrictId = $_POST['cmbDistrict'];
            $caseDisease = $_POST['cmbDisease'];
            $casefatal = $_POST['cmbFatal'];
            $caseReportedOn = $_POST['txtReportedOn'];
            $caseDiedOn = $_POST['txtDiedOn'];
            $caseDate = $_POST['txtCaseDate'];
        }
        /* check for edit page.Edit option is shown */
        if (isset($_GET['casereportid'])) {
            $id = "edit";
            $caseId = $_GET['casereportid'];
            $resultCaseReport = mysql_query("SELECT * FROM casereport where\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcasereportid='{$caseId}'") or die(mysql_error());
            $rowCaseReport = mysql_fetch_array($resultCaseReport);
            $caseName = $rowCaseReport['name'];
            $caseAge = $rowCaseReport['age'];
            $caseSex = $rowCaseReport['sex'];
            $caseAddress1 = $rowCaseReport['address1'];
            $caseAddress2 = $rowCaseReport['address2'];
            $casePincode = $rowCaseReport['pincode'];
            $caseDiseaseId = $rowCaseReport['diseaseid'];
            $caseDistrictId = $rowCaseReport['districtid'];
            $caseHospitalId = $rowCaseReport['hospitalid'];
            $casePostOfficeId = $rowCaseReport['postofficeid'];
            $caseFatal = $rowCaseReport['fatal'];
            $caseReportedOn = getDateFromDb($rowCaseReport['reportedon']);
            if ($rowCaseReport['diedon'] == "") {
                $caseDiedOn = " ";
            } else {
                $caseDiedOn = getDateFromDb($rowCaseReport['diedon']);
            }
            $caseDate = getDateFromDb($rowCaseReport['casedate']);
        } else {
            $id = "add";
        }
        if ($flag == 'success') {
            echo '<h3>Updated Successfully</h3>';
        } else {
            echo "\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<td >";
            if ($id == "edit") {
                echo "<h3>Edit Case Report</h3>";
            } else {
                echo "<h3>Add Case Report</h3>";
            }
            echo "\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<i> ( Fields marked with * are compulsary. )</i>\n\t\t\t\t\t\t<form   action=\"addcasereport.php\"\n\t\t\t\t\t\t\tonsubmit=\"javascript:return validateCaseReportForm('" . $UserType . "','" . $id . "')\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    method=\"POST\">\n\t\t\t\t\t\t\t<table class=\"formTab\">\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\t\t\tName of Patient *\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t  <input type=\"text\" name=\"txtName\" id=\"txtName\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxlength=\"50\" value='" . $caseName . "' />\n\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t <i> ( Enter name of the patient. )</i>\n\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errName\">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\t\tAge *\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t  <input type=\"text\" name=\"txtAge\" id=\"txtAge\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxlength=\"3\" value='" . $caseAge . "' />\n\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errAge\">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\t\tSex *\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"formContent\">";
            if ($caseSex == "Female") {
                echo "<input type=\"radio\" name=\"rdoSex\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue=\"Male\" />\tMale\n\t\t\t\t\t\t\t\t\t  <input type=\"radio\" name=\"rdoSex\" id=\"rdoSex\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue=\"Female\" checked=\"checked\" />\tFemale";
            } else {
                echo " <input type=\"radio\" name=\"rdoSex\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue=\"Male\" checked=\"checked\" />\tMale\n\t\t\t\t\t\t\t\t\t  <input type=\"radio\" name=\"rdoSex\" id=\"rdoSex\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue=\"Female\" />\tFemale";
            }
            echo "\t<br>\n\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errSex\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tAddress1 *\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t  <input type=\"text\" name=\"txtAddress1\" id=\"txtAddress1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxlength=\"100\" value='" . $caseAddress1 . "' />\n\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t <i> ( Enter address of the patient. )</i>\n\t\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errAddress1\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tAddress2\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t  <input type=\"text\" name=\"txtAddress2\" id=\"txtAddress2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxlength=\"100\" value='" . $caseAddress2 . "' />\n\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errAddress2\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tDistrict *\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t<select name=\"cmbDistrict\" id=\"cmbDistrict\"\n\t\t\t\t\t\t\t\t\t\t\t\tonchange=\"javascript:selectPostOffice(this)\" >\n\t\t\t\t\t\t\t\t\t<option selected value=\"select\">--select--</option>";
            for ($intCount = 0; $intCount < count($arrDistrictId); $intCount++) {
                if ($arrDistrictId[$intCount] == $caseDistrictId) {
                    echo '<option selected	value="' . $arrDistrictId[$intCount] . '">' . $arrDistrict[$intCount] . '</option>';
                } else {
                    echo '<option value="' . $arrDistrictId[$intCount] . '">' . $arrDistrict[$intCount] . '</option>';
                }
            }
            echo "\t\t</select>\n\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t <i> ( Select district of the patient. )</i>\n\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t <div class=\"dsplyWarning\" id=\"errDistrict\">\n\t\t \t\t\t\t\t </div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tPost Office *\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\" id=\"postOfficeId\">\n\t\t\t\t\t\t\t\t<select name=\"cmbPostOffice\" id=\"cmbPostOffice\" >\n\t\t\t\t\t\t\t\t\t<option value=\"select\">--select--</option>";
            if ($id == "edit") {
                $resultPO = mysql_query("select name from postoffice\n\t\t\t\t\t\t\t\t\t\twhere postofficeid='" . $casePostOfficeId . "' ") or die(mysql_error());
                $rowPO = mysql_fetch_array($resultPO);
                echo '<option selected value="' . $casePostOfficeId . '">
											' . $rowPO['name'] . '</option>';
            }
            echo "</select>\n\t\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t\t <i> ( Select post office of the patient. )</i>\n\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errPostOffice\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class= \"hideTr\" id=\"newPostOfficeTr\">\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tSpecify the Post office name\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\" >\n\t\t\t\t\t\t\t  <input type=\"text\" name=\"txtNewPostOffice\"\n\t\t\t\t\t\t\t\t\t\tid=\"txtNewPostOffice\"/>\n\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errNewPostOffice\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class= \"hideTr\" id=\"nearPostOfficeTr\">\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tNear Post Office\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\" id=\"NearpostOfficeId\">\n\t\t\t\t\t\t\t\t<select name=\"cmbNearPostOffice\" id=\"cmbNearPostOffice\">\n\t\t\t\t\t\t\t\t\t<option value=\"select\">--select--</option>\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tPincode\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t <input type=\"text\" name=\"txtPincode\" id=\"txtPincode\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxlength=\"6\" value='" . $casePincode . "' />\n\t\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t\t <div class=\"dsplyWarning\" id=\"errPincode\">\n\t\t\t \t\t\t\t\t </div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tHospital *\n\t\t\t\t\t\t\t</td>";
            if ($UserType == "HOSPITAL") {
                $username = $_SESSION['userName'];
                $result = mysql_query("SELECT name,hospitalid FROM hospital WHERE\n\t\t\t\t\t\t\t\t\t\t\tusername='******' ") or die(mysql_error());
                $row = mysql_fetch_array($result);
                $hName = $row['name'];
                $hId = $row['hospitalid'];
                echo "<td class=\"formContent\">";
                if ($id == "edit") {
                    echo "<input class=\"noBrdrInput\" type=\"text\" readonly\n\t\t\t\t\t\t\t\t\t\t\t\t name=\"txtHospital\"\tid=\"txtHospital\" value='" . $hName . "'/>";
                } else {
                    echo "<input class=\"noBrdrInput\" type=\"text\" readonly\n\t\t\t\t\t\t\t\t\t\t\t\t name=\"txtHospital\" id=\"txtHospital\" value='" . $hName . "'/>";
                }
                echo "<input type=\"hidden\" name=\"cmbHospital\" id=\"cmbHospital\"\n\t\t\t\t\t\t\t\t\t\t value='" . $hId . "' />\n\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errHospital\">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>";
            } else {
                if ($UserType == "GMO" || $UserType == "DAO" || $UserType == "ADMIN") {
                    $username = $_SESSION['userName'];
                    if ($UserType == "GMO") {
                        $resultGmo = mysql_query("select districtid from gmo\n\t\t\t\t\t\t\t\t\t\twhere username='******' ") or die(mysql_error());
                        $rowGmo = mysql_fetch_array($resultGmo);
                        $distId = $rowGmo['districtid'];
                        $result = mysql_query("SELECT hospital.name, hospital.hospitalid,\n\t\t\t\t\t\t\t\t\t\thospital.districtid ,user.status\n\t\t\t\t\t\t\t\t\t\tFROM hospital\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN user on  hospital.username= user.username\n\t\t\t\t\t\t\t\t\t\tWHERE\thospital.districtid='" . $distId . "'\n\t\t\t\t\t\t\t\t\t\t\t\tand user.status ='Approved'") or die(mysql_error());
                    } else {
                        if ($UserType == "DAO") {
                            $resultDao = mysql_query("select districtid from dao\n\t\t\t\t\t\t\t\t\t\twhere username='******' ") or die(mysql_error());
                            $rowDao = mysql_fetch_array($resultDao);
                            $distId = $rowDao['districtid'];
                            $result = mysql_query("SELECT hospital.name, hospital.hospitalid,\n\t\t\t\t\t\t\t\t\t\thospital.districtid, user.status\n\t\t\t\t\t\t\t\t\t\tFROM hospital\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN user on  hospital.username= user.username\n\t\t\t\t\t\t\t\t\t\tWHERE\thospital.districtid='" . $distId . "'\n\t\t\t\t\t\t\t\t\t\t\tand user.status ='Approved'") or die(mysql_error());
                        } else {
                            if ($UserType == "ADMIN") {
                                $result = mysql_query("SELECT hospital.name, hospital.hospitalid,\n\t\t\t\t\t\t\t\t\t\thospital.districtid\tFROM hospital\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN user on  hospital.username= user.username\n\t\t\t\t\t\t\t\t\t\tWHERE\tuser.status ='Approved'") or die(mysql_error());
                            } else {
                            }
                        }
                    }
                    $intcount = 0;
                    while ($crow = mysql_fetch_array($result)) {
                        $arrHospital[$intcount] = $crow['name'];
                        $arrHospitalId[$intcount] = $crow['hospitalid'];
                        $intcount++;
                    }
                    echo "<td class=\"formContent\" id=\"hospitalId\" >\n\t\t\t\t\t\t\t\t\t<select name=\"cmbHospital\" id=\"cmbHospital\" >\n\t\t\t\t\t\t\t\t\t\t<option selected value=\"select\">--select--</option>";
                    for ($intCount = 0; $intCount < count($arrHospitalId); $intCount++) {
                        if ($arrHospitalId[$intCount] == $caseHospitalId) {
                            echo '<option selected	value="' . $arrHospitalId[$intCount] . '">' . $arrHospital[$intCount] . '</option>';
                        } else {
                            echo '<option value="' . $arrHospitalId[$intCount] . '">' . $arrHospital[$intCount] . '</option>';
                        }
                    }
                    echo "</select>\n\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t<div class=\"dsplyWarning\" id=\"errHospital\">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>";
                } else {
                    echo "\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t</td>";
                }
            }
            echo "</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tDisease *\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t<select name=\"cmbDisease\" id=\"cmbDisease\" >\n\t\t\t\t\t\t\t\t\t<option selected value=\"select\">--select--</option>";
            for ($intCount = 0; $intCount < count($arrDiseaseId); $intCount++) {
                if ($arrDiseaseId[$intCount] == $caseDiseaseId) {
                    echo '<option selected	value="' . $arrDiseaseId[$intCount] . '">' . $arrDisease[$intCount] . '</option>';
                } else {
                    echo '<option value="' . $arrDiseaseId[$intCount] . '">' . $arrDisease[$intCount] . '</option>';
                }
            }
            echo "\t</select>\n\t\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t\t <div class=\"dsplyWarning\" id=\"errDisease\">\n\t\t\t \t\t\t\t\t </div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tStatus *\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t<select name=\"cmbFatal\" id=\"cmbFatal\" >\n\t\t\t\t\t\t\t\t\t<option selected value=\"select\">--select--</option>";
            for ($intCount = 0; $intCount < count($arrFatal); $intCount++) {
                if ($arrFatal[$intCount] == $caseFatal) {
                    echo '<option selected	value="' . $arrFatal[$intCount] . '">' . $arrFatal[$intCount] . '</option>';
                } else {
                    echo '<option value="' . $arrFatal[$intCount] . '">' . $arrFatal[$intCount] . '</option>';
                }
            }
            echo "</select>\n\t\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t\t <div class=\"dsplyWarning\" id=\"errFatal\">\n\t\t\t \t\t\t\t\t </div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\tDied on\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t <input type=\"text\" name=\"txtDiedOn\" id=\"txtDiedOn\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxlength=\"10\" value='" . $caseDiedOn . "' />(DD/MM/YYYY)<br>\n\t\t\t\t\t\t\t\t <div class=\"dsplyWarning\" id=\"errDiedOn\">\n\t\t \t\t\t\t\t </div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tCase Date *\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t <input type=\"text\" name=\"txtCaseDate\" id=\"txtCaseDate\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxlength=\"10\" value='" . $caseDate . "' />(DD/MM/YYYY)<br>\n\t\t\t\t\t\t\t\t <i> ( Date on which patient started showing symptoms. )</i>\n\t\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t\t <div class=\"dsplyWarning\" id=\"errCaseDate\">\n\t\t\t \t\t\t\t\t </div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"formLabel\">\n\t\t\t\t\t\t\t\tReported on *\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class=\"formContent\">\n\t\t\t\t\t\t\t\t <input type=\"text\" name=\"txtReportedOn\" id=\"txtReportedOn\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tmaxlength=\"10\" value='" . $caseReportedOn . "' />(DD/MM/YYYY)\n\t\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t\t <i> ( Date on which case was reported to the authorities. )</i>\n\t\t\t\t\t\t\t\t <br>\n\t\t\t\t\t\t\t\t <div class=\"dsplyWarning\" id=\"errReportedOn\">\n\t\t\t \t\t\t\t\t </div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input \ttype=\"hidden\" name=\"Id\" id=\"txtId\" value='" . $id . "'>";
            if ($id == 'edit') {
                echo '<input type="hidden" name="txtCaseId"   id="txtCaseId"
															value=' . $caseId . '>';
            } else {
            }
            echo "\t</td>\n\t\t\t\t\t\t\t<td>";
            if ($id == "edit") {
                echo "<br>\n\t\t\t\t\t\t\t\t<input class=\"subButton\" type=\"submit\" value=\"Submit\" name=\"Submit\" />\n\t\t\t\t\t\t\t\t&nbsp;&nbsp;\n\t\t\t\t\t\t\t\t<input class=\"backButton\" type=\"button\" value=\"Back\" name=\"Back\"\n\t\t\t\t\t\t\t\t\t\t\tonclick=\"javascript:changeViewPage('" . $lastUrl . "')\">";
            } else {
                echo "<br>\n\t\t\t\t\t\t\t\t<input class=\"subButton\" type=\"submit\" value=\"Submit\" name=\"Submit\" />\n\t\t\t\t\t\t\t\t&nbsp;&nbsp;\n\t\t\t\t\t\t\t\t<input class=\"backButton\" type=\"button\" value=\"Cancel\" name=\"Back\"\n\t\t\t\t\t\t\t\t\t\t\tonclick=\"javascript:changePage()\">";
            }
            echo "\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan=\"2\">";
            if ($flag == 'true') {
                echo '<h3>Saved Successfully</h3>';
            } else {
                if ($flag == 'false') {
                    echo '<h3>Case already Reported</h3>';
                } else {
                    if ($flag == 'phpValidError') {
                        echo '<h3>Error in given details.Check whether javascript is enabled or check whether you have entered valid details</h3>';
                    } else {
                    }
                }
            }
            echo "\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t</form>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>";
        }
    } else {
        echo '<h3>No data is stored in the database or you are not authorised to view this data</h3>';
    }
}
function displayContent($authorise)
{
    if (isset($_GET['userView'])) {
        $id = "userView";
        $userName = $_GET['userView'];
    } else {
        if (isset($_GET['userApp'])) {
            $id = "userApprove";
            $userName = $_GET['userApp'];
        } else {
            if (isset($_GET['daoApp'])) {
                $id = "daoApprove";
                $userName = $_GET['daoApp'];
            } else {
                if (isset($_GET['hosApp'])) {
                    $id = "hosApprove";
                    $userName = $_GET['hosApp'];
                } else {
                    $id = "";
                    $userName = "";
                }
            }
        }
    }
    getLastUrl();
    $lastUrl = $_SESSION['lastUrl'];
    $name = "";
    $designation = "";
    $username = "";
    $emailid = "";
    $address1 = "";
    $address2 = "";
    $phnum1 = "";
    $phnum2 = "";
    $mobnum = "";
    $disid = "";
    $stateid = "";
    $status = "";
    $regno = "";
    $pincode = "";
    $DistName = "";
    $StateName = "";
    $userTable = "";
    $strContent = '<form action="./viewuser.php" method="GET">';
    $strContent .= '<h3>View User</h3>';
    $result = mysql_query("SELECT * FROM user where username='******' ") or die(mysql_error());
    $row = mysql_fetch_array($result);
    $userType = $row['usertype'];
    if ($userType == "GMO") {
        $userTable = "gmo";
        $Gresult = mysql_query("SELECT * FROM gmo where username='******' ") or die(mysql_error());
        $Grow = mysql_fetch_array($Gresult);
        $name = $Grow['name'];
        $designation = $Grow['designation'];
        $username = $Grow['username'];
        $emailid = $Grow['emailid'];
        $address1 = $Grow['officeaddress1'];
        $address2 = $Grow['officeaddress2'];
        $phnum1 = $Grow['officephno1'];
        $phnum2 = $Grow['officephno2'];
        $mobnum = $Grow['mobilenumber'];
        $disid = $Grow['districtid'];
        $stateid = $Grow['stateid'];
        $status = $Grow['status'];
    } else {
        if ($userType == "DAO") {
            $userTable = "dao";
            $Dresult = mysql_query("SELECT * FROM dao where username='******' ") or die(mysql_error());
            $Drow = mysql_fetch_array($Dresult);
            $name = $Drow['name'];
            $designation = $Drow['designation'];
            $username = $Drow['username'];
            $emailid = $Drow['emailid'];
            $address1 = $Drow['address1'];
            $address2 = $Drow['address2'];
            $phnum1 = $Drow['phonenumber'];
            $mobnum = $Drow['mobilenumber'];
            $disid = $Drow['districtid'];
            $stateid = $Drow['stateid'];
            $status = $Drow['status'];
        } else {
            if ($userType == "HOSPITAL") {
                $userTable = "hospital";
                $Hresult = mysql_query("SELECT * FROM hospital where username='******' ") or die(mysql_error());
                $Hrow = mysql_fetch_array($Hresult);
                $name = $Hrow['name'];
                $username = $Hrow['username'];
                $emailid = $Hrow['emailid'];
                $regno = $Hrow['registerno'];
                $address1 = $Hrow['hospitaladdress1'];
                $address2 = $Hrow['hospitaladdress2'];
                $phnum1 = $Hrow['hospitalphno1'];
                $phnum2 = $Hrow['hospitalphno2'];
                $mobnum = $Hrow['mobilenumber'];
                $pincode = $Hrow['pincode'];
                $disid = $Hrow['districtid'];
                $stateid = $Hrow['stateid'];
                $status = $Hrow['status'];
            } else {
            }
        }
    }
    $Dist = mysql_query("SELECT name FROM district where districtid='" . $disid . "' ") or die(mysql_error());
    $Distrow = mysql_fetch_array($Dist);
    $DistName = $Distrow['name'];
    $state = mysql_query("SELECT name FROM state where stateid='" . $stateid . "' ") or die(mysql_error());
    $Staterow = mysql_fetch_array($state);
    $StateName = $Staterow['name'];
    $strContent .= '	<table>
							<tr>
								<td class="formLabel">
									Name
								</td>
								<td class="formContent">
									' . $name . '
								</td>
							</tr>';
    if ($userType == "GMO" || $userType == "DAO") {
        $strContent .= '	<tr>
								<td class="formLabel">
									Designation
								</td>
								<td class="formContent">
									' . $designation . '
								</td>
							</tr>';
    }
    $strContent .= '			<tr>
								<td class="formLabel">
									Address1
								</td>
								<td class="formContent">
									' . $address1 . '
								</td>
							</tr>
							<tr>
								<td class="formLabel">
									Address2
								</td>
								<td class="formContent">
									' . $address2 . '
								</td>
							</tr>
							<tr>
								<td class="formLabel">
									Email
								</td>
								<td class="formContent">
									' . $emailid . '
								</td>
							</tr>
							<tr>
								<td class="formLabel">
									Phone Number 1
								</td>
								<td class="formContent">
									' . $phnum1 . '
								</td>
							</tr>';
    if ($userType == "GMO" || $userType == "HOSPITAL") {
        $strContent .= '			<tr>
								<td class="formLabel">
									Phone Number 2
								</td>
								<td class="formContent">
									' . $phnum2 . '
								</td>
							</tr>';
    }
    $strContent .= '			<tr>
								<td class="formLabel">
									Mobile Number
								</td>
								<td class="formContent">
									' . $mobnum . '
								</td>
							</tr>
							<tr>
								<td class="formLabel">
									District
								</td>
								<td class="formContent">
									' . $DistName . '
								</td>
							</tr>
							<tr>
								<td class="formLabel">
									UserName
								</td>
								<td class="formContent">
									' . $username . '
								</td>
							</tr>
							<tr>
								<td class="formLabel">
									State
								</td>
								<td class="formContent">
									' . $StateName . '
								</td>
							</tr>
							<tr>
								<td class="formLabel">
									Status
								</td>
								<td class="formContent">
									' . $status . '
								</td>
							</tr>';
    if ($userType == "HOSPITAL") {
        $strContent .= '			<tr>
								<td class="formLabel">
									Pincode
								</td>
								<td class="formContent">
									' . $pincode . '
								</td>
							</tr>';
    }
    $strContent .= '<tr>
				<td colspan="2">';
    if ($id == "userView") {
        $strContent .= '<br>
							<input class="backButton" type="button" value="Back" onclick="javascript:changePage(\'' . $lastUrl . '\')">
								&nbsp;&nbsp;
							<input class="chStatusButton" type="button" value="Change Status"
									onclick="javascript:changeStatus(\'' . $userName . '\',\'' . $userTable . '\')">
							&nbsp;&nbsp;
							<input class="delButton" type="button" value="Delete"
								onclick="javascript:deleteUser(\'' . $userName . '\')">';
    } else {
        if ($id == "userApprove") {
            $strContent .= '<br>
							<input class="backButton" type="button" value="Back" onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">
							&nbsp;&nbsp;
							<input class="appButton" type="button" value="Approve User"
								onclick="javascript:approveUser(\'' . $userName . '\',\'' . $userTable . '\')">
							&nbsp;&nbsp;
							<input class="delButton" type="button" value="Delete"
								onclick="javascript:deleteNewUser(\'' . $userName . '\')">';
        } else {
            if ($id == "daoApprove") {
                $strContent .= '<br>
							<input class="backButton" type="button" value="Back" onclick="javascript:changeDaoViewPage(\'' . $lastUrl . '\')">
							&nbsp;&nbsp;
							<input class="appButton" type="button" value="Approve User"
								onclick="javascript:approveDao(\'' . $userName . '\',\'' . $userTable . '\')">
							&nbsp;&nbsp;
							<input class="delButton" type="button" value="Delete"
								onclick="javascript:deleteNewDao(\'' . $userName . '\')">';
            } else {
                if ($id == "hosApprove") {
                    $strContent .= '<br>
							<input class="backButton" type="button" value="Back" onclick="javascript:changeHosViewPage(\'' . $lastUrl . '\')">
							&nbsp;&nbsp;
							<input class="appButton" type="button" value="Approve User"
								onclick="javascript:approveHos(\'' . $userName . '\',\'' . $userTable . '\')">
							&nbsp;&nbsp;
							<input class="delButton" type="button" value="Delete"
								onclick="javascript:deleteNewHos(\'' . $userName . '\')">';
                } else {
                }
            }
        }
    }
    $strContent .= '</td>
			</tr>
		</table>
	</form>';
    return $strContent;
}
function showMdlCol($authorise, $blnFlag)
{
    if ($authorise == "GMO" || $authorise == "ADMIN" || $authorise == "DAO") {
        $intCount = 0;
        $resultdist = mysql_query("select * from district") or die(mysql_error());
        while ($rowdist = mysql_fetch_array($resultdist)) {
            $arrDistrict[$intCount] = $rowdist['name'];
            $arrDistrictId[$intCount] = $rowdist['districtid'];
            $intCount++;
        }
        $intCount = 0;
        $resultDis = mysql_query("select * from disease") or die(mysql_error());
        while ($rowDis = mysql_fetch_array($resultDis)) {
            $arrDisease[$intCount] = $rowDis['name'];
            $arrDiseaseId[$intCount] = $rowDis['diseaseid'];
            $intCount++;
        }
        $strId = "";
        $intReportedNo = "";
        $intFatalNo = "";
        if ($blnFlag == 'false' || $blnFlag == 'phpValidError') {
            $intDistrictId = trim($_POST['cmbDistrict']);
            $intDiseaseId = trim($_POST['cmbDisease']);
            $intReportedNo = trim($_POST['txtReportedNo']);
            $intFatalNo = trim($_POST['txtFatalNo']);
        }
        if (isset($_GET['intBulkCaseId'])) {
            $strId = "edit";
            $intBulkCaseId = $_GET['intBulkCaseId'];
            $resultCase = mysql_query("SELECT * FROM bulkcase where bulkcaseid='{$intBulkCaseId}' ") or die(mysql_error());
            $rowCase = mysql_fetch_array($resultCase);
            $intDistrictId = $rowCase['districtid'];
            $intDiseaseId = $rowCase['diseaseid'];
            $intReportedNo = $rowCase['reportedcase'];
            $intFatalNo = $rowCase['fatalcase'];
            $dteCreatedon = getDateFromDb($rowCase['createdon']);
        } else {
            if (isset($_GET['intBulkCaseViewId'])) {
                $strId = "view";
                $intBulkCaseId = $_GET['intBulkCaseViewId'];
                $resultCase = mysql_query("SELECT * FROM bulkcase where bulkcaseid='{$intBulkCaseId}' ") or die(mysql_error());
                $rowCase = mysql_fetch_array($resultCase);
                $intDistrictId = $rowCase['districtid'];
                $intDiseaseId = $rowCase['diseaseid'];
                $intReportedNo = $rowCase['reportedcase'];
                $intFatalNo = $rowCase['fatalcase'];
                $dteCreatedon = getDateFromDb($rowCase['createdon']);
            } else {
                $strId = "add";
            }
        }
        if ($blnFlag == 'success') {
            echo '<h3>Updated Successfully</h3>';
        } else {
            getLastUrl();
            $lastUrl = $_SESSION['lastUrl'];
            echo '<table class="tblForm">
				<tr>
					<td>';
            if ($strId == "view") {
                echo '<h3>View Bulk Case Reports</h3>';
            } else {
                if ($strId == "edit") {
                    echo '<h3>Edit View Bulk Case Reports</h3>';
                } else {
                    echo '<h3>Add Bulk Case Reports</h3>';
                }
            }
            echo '</td>
				</tr>
				<tr>
					<td>';
            if ($strId != "view") {
                echo '<i> ( Fields marked with * are compulsary. )</i>';
            }
            echo '<form action="./addbulkcasereport.php"
										 name="addBulkCase" id="addBulkCase"
										 onsubmit="javascript:return validateAddBulkForm()" method="POST">
							<table class="formTab">
								<tr>
									<td class="formLabel">
										District';
            if ($strId != "view") {
                echo ' *';
            }
            echo '	</td>
									<td class="formContent">';
            if ($strId == "view") {
                for ($intCount = 0; $intCount < count($arrDistrictId); $intCount++) {
                    if ($arrDistrictId[$intCount] == $intDistrictId) {
                        $districtName = $arrDistrict[$intCount];
                        break;
                    }
                }
                echo ' : ' . $districtName;
            } else {
                echo '<select name="cmpDistrict" id="cmpDistrict">
												<option selected value="select">--select--</option>';
                for ($intCount = 0; $intCount < count($arrDistrictId); $intCount++) {
                    if ($arrDistrictId[$intCount] == $intDistrictId) {
                        echo '<option selected	value="' . $arrDistrictId[$intCount] . '">' . $arrDistrict[$intCount] . '</option>';
                    } else {
                        echo '<option value="' . $arrDistrictId[$intCount] . '">' . $arrDistrict[$intCount] . '</option>';
                    }
                }
                echo '</select>
											<br>
											<div class="dsplyWarning" id="errDistrict">
											</div>';
            }
            echo '</td>
								</tr>
								<tr>
									<td class="formLabel">
										Disease';
            if ($strId != "view") {
                echo ' *';
            }
            echo '	</td>
									<td class="formContent">';
            if ($strId == "view") {
                for ($intCount = 0; $intCount < count($arrDiseaseId); $intCount++) {
                    if ($arrDiseaseId[$intCount] == $intDiseaseId) {
                        $diseaseName = $arrDisease[$intCount];
                        break;
                    }
                }
                echo ' : ' . $diseaseName;
            } else {
                echo '<select name="cmpDisease" id="cmpDisease">
												<option selected value="select">--select--</option>';
                for ($intCount = 0; $intCount < count($arrDiseaseId); $intCount++) {
                    if ($arrDiseaseId[$intCount] == $intDiseaseId) {
                        echo '<option selected	value="' . $arrDiseaseId[$intCount] . '">' . $arrDisease[$intCount] . '</option>';
                    } else {
                        echo '<option value="' . $arrDiseaseId[$intCount] . '">' . $arrDisease[$intCount] . '</option>';
                    }
                }
                echo '</select>
											<br>
											<div class="dsplyWarning" id="errDisease">
											</div>';
            }
            echo '</td>
								</tr>
								<tr>
									<td class="formLabel">
										Reported cases';
            if ($strId != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($strId == "view") {
                echo ': ' . $intReportedNo;
            } else {
                echo '<input type="text" name="txtReportedNo" id="txtReportedNo"
															maxlength="6" value="' . $intReportedNo . '" >';
            }
            if ($strId != "view") {
                echo '<br><i> ( Enter the total number of reported cases. )
											</i>';
            }
            echo '<br>
										 <div class="dsplyWarning" id="errReportedNo">
										 </div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										Fatal cases
									</td>
									<td class="formContent">';
            if ($strId == "view") {
                echo ': ' . $intFatalNo;
            } else {
                echo '<input type="text" name="txtFatalNo" id="txtFatalNo"
															maxlength="6" value="' . $intFatalNo . '" >';
            }
            if ($strId != "view") {
                echo '<br><i> ( Enter the number of fatal cases in the reported cases. )
											</i>';
            }
            echo '<br>
										 <div class="dsplyWarning" id="errFatalNo">
										 </div>
									</td>
								</tr>';
            if ($strId == "view" || $strId == "edit") {
                echo '<tr>
										<td class="formLabel">
											Created Date
										</td>
										<td class="formContent">';
                if ($strId == "view") {
                    echo ': ' . $dteCreatedon;
                } else {
                    echo '<input class="noBrdrInput" READONLY type="text"
													value="' . $dteCreatedon . '" >';
                }
                echo '</td>
									</tr>';
            }
            echo '<tr>
									<td>
										<input type="hidden" name="txtId" id="txtId" value="' . $strId . '" >';
            if ($strId == 'edit') {
                echo '<input type="hidden" name="txtBulkCaseId"   id="txtBulkCaseId"
																value="' . $intBulkCaseId . '" >';
            }
            echo '</td>
									<td>';
            if ($strId == 'add') {
                echo '<br>
											<input class="subButton" type="submit" value="Submit" name="Submit">
											&nbsp;&nbsp;
											<input class="backButton" type="button" value="Cancel" name="Back"
												onclick="javascript:changePage()">';
            } else {
                if ($strId == 'edit') {
                    echo '<br>
											<input class="subButton" type="submit" value="Submit" name="Submit">
											&nbsp;&nbsp;';
                    echo '<input class="backButton" type="button" value="Back" name="Back"
													onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">';
                } else {
                    if ($strId == 'view') {
                        echo '<input class="backButton" type="button" value="Back" name="Back"
												onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">';
                    } else {
                    }
                }
            }
            echo '</td>
								</tr>
								<tr>
									<td colspan="2">';
            if ($blnFlag == 'true') {
                echo '<h3>Case reports Saved Successfully</h3>';
            } else {
                if ($blnFlag == 'success') {
                    echo '<h3>Case reports Updated Successfully</h3>';
                } else {
                    if ($blnFlag == 'phpValidError') {
                        echo '<h3>Error in given details.Check whether javascript is enabled or check whether you have entered valid details</h3>';
                    } else {
                    }
                }
            }
            echo '</td>
								</tr>
							</table>
						</form>
					</td>
				</tr>
			</table>';
        }
    } else {
        echo '<h3>No data is stored in the database or you are not authorised to view this data
					</h3>';
    }
}
function showMdlCol($authorise, $flag)
{
    if ($authorise == "DAO" || $authorise == "GMO" || $authorise == "ADMIN") {
        $intCount = 0;
        $resultdist = mysql_query("select * from district") or die(mysql_error());
        while ($rowdist = mysql_fetch_array($resultdist)) {
            $arrDistrict[$intCount] = $rowdist['name'];
            $arrDistrictId[$intCount] = $rowdist['districtid'];
            $intCount++;
        }
        getLastUrl();
        $lastUrl = $_SESSION['lastUrl'];
        $name = "";
        $distId = "";
        $latitude = "";
        $longitude = "";
        $pincode = "";
        $id = "";
        $poId = "";
        $newPoId = "";
        if ($flag == 'false' || $flag == 'phpValidError') {
            $name = $_POST['txtName'];
            $distId = $_POST['cboDistrict'];
            $latitude = $_POST['txtLatitude'];
            $longitude = $_POST['txtLongitude'];
            $pincode = $_POST['txtPincode'];
        }
        if (isset($_GET['poid'])) {
            $id = "edit";
            $poId = $_GET['poid'];
            $postOfficeId = $_GET['poid'];
            $resultPO = mysql_query("SELECT * FROM postoffice where postofficeid='{$postOfficeId}'") or die(mysql_error());
            $rowPO = mysql_fetch_array($resultPO);
            $name = $rowPO['name'];
            $distId = $rowPO['districtid'];
            $latitude = $rowPO['latitude'];
            $longitude = $rowPO['longitude'];
            $pincode = $rowPO['pincode'];
        } else {
            if (isset($_GET['poViewId'])) {
                $id = "view";
                $postOfficeId = $_GET['poViewId'];
                $resultPO = mysql_query("SELECT * FROM postoffice where postofficeid='{$postOfficeId}'") or die(mysql_error());
                $rowPO = mysql_fetch_array($resultPO);
                $name = $rowPO['name'];
                $distId = $rowPO['districtid'];
                $latitude = $rowPO['latitude'];
                $longitude = $rowPO['longitude'];
                $pincode = $rowPO['pincode'];
            } else {
                if (isset($_GET['newpoid'])) {
                    $id = "editNew";
                    $newPoId = $_GET['newpoid'];
                    $postOfficeId = $_GET['newpoid'];
                    $resultPO = mysql_query("SELECT * FROM newpostoffice where postofficeid='{$postOfficeId}'") or die(mysql_error());
                    $rowPO = mysql_fetch_array($resultPO);
                    $name = $rowPO['name'];
                    $distId = $rowPO['districtid'];
                    $latitude = "";
                    $longitude = "";
                    $pincode = $rowPO['pincode'];
                } else {
                    $id = "add";
                }
            }
        }
        if ($flag == 'success') {
            echo '<h3>Updated Successfully</h3>';
        } else {
            echo '<table class="tblForm">
				<tr>
					<td>';
            if ($id == "view") {
                echo '<h3>View Postoffice Details</h3>';
            } else {
                if ($id == "edit") {
                    echo '<h3>Edit Postoffice Details</h3>';
                } else {
                    echo '<h3>Add Postoffice</h3>';
                }
            }
            echo '</td>
				</tr>
				<tr>
					<td>';
            if ($id != "view") {
                echo '<i> ( Fields marked with * are compulsary. )</i>';
            }
            echo '<form action="./addpostoffice.php"
										 name="addPostOfficeForm" id="addPostOfficeForm"
										 onsubmit="javascript:return validatePOForm()" method="POST">
							<table class="formTab">
								<tr>
									<td class="formLabel">
										Name';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $name;
            } else {
                echo '	<input type="text" name="txtName" id="txtName" maxlength="50"
												value="' . $name . '"';
                if ($id == "edit") {
                    echo ' class="noBrdrInput" READONLY';
                }
                echo '><br>';
            }
            if ($id != "view") {
                echo '<i> ( Enter Name of the Post office. )</i><br>';
            }
            echo '<div class="dsplyWarning" id="errName">
										</div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										District';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($id == "view") {
                for ($intCount = 0; $intCount < count($arrDistrictId); $intCount++) {
                    if ($arrDistrictId[$intCount] == $distId) {
                        $districtName = $arrDistrict[$intCount];
                        break;
                    }
                }
                echo ': ' . $districtName;
            } else {
                echo '<select name="cboDistrict" id="cboDistrict">
												<option selected value="select">--select--</option>';
                for ($intCount = 0; $intCount < count($arrDistrictId); $intCount++) {
                    if ($arrDistrictId[$intCount] == $distId) {
                        echo '<option selected	value="' . $arrDistrictId[$intCount] . '">' . $arrDistrict[$intCount] . '</option>';
                    } else {
                        echo '<option value="' . $arrDistrictId[$intCount] . '">' . $arrDistrict[$intCount] . '</option>';
                    }
                }
                echo '</select><br>
											<div class="dsplyWarning" id="errDistrict">
					 					 </div>';
            }
            echo '</td>
								</tr>
								<tr>
									<td class="formLabel">
										Pincode';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $pincode;
            } else {
                echo '<input type="text" name="txtPincode" id="txtPincode"
																maxlength="6" value="' . $pincode . '" ';
                echo '><br>';
            }
            if ($id != "view") {
                echo '<i> ( Enter the pincode of the Post office. )
											</i><br>';
            }
            echo '<div class="dsplyWarning" id="errPincode">
										</div>
									</td>
								</tr>';
            if ($id != "view") {
                echo '<tr>
										<td class="formLabel">
											Pick place [click on the image and select place from the map to get the Latitude and Longitude of the postoffice]
										</td>
										<td class="formContent">
											&nbsp; &nbsp;
											<img class="linkImage" src="../images/pickplace.gif" alt="Pick Place"
												style="width:80px; height:40px" onclick="javascript:pickPlacePopup()">
										</td>
									</tr>';
            }
            echo '<tr>
									<td class="formLabel">
										Latitude';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $latitude;
            } else {
                echo '<input class="noBrdrInput" type="text" name="txtLatitude" id="txtLatitude"
											value="' . $latitude . '" ';
                echo '><br>';
            }
            echo '<div class="dsplyWarning" id="errLatitude">
										</div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										Longitude';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $longitude;
            } else {
                echo '<input class="noBrdrInput" type="text"name="txtLongitude"
												 id="txtLongitude" value="' . $longitude . '" ';
                echo '><br>';
            }
            echo '<div class="dsplyWarning" id="errLongitude">
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<input type="hidden" name="Id" id="Id" value="' . $id . '" >
										<input type="hidden" name="poId" id="poId" value="' . $poId . '" >
										<input type="hidden" name="newPoId" id="newPoId" value="' . $newPoId . '" >
									</td>
									<td>';
            if ($id == 'add') {
                echo '<br>
											<input class="subButton" type="submit" value="Submit" name="Submit">
											&nbsp;&nbsp;
											<input class="backButton" type="button" value="Cancel" name="Back"
													onclick="javascript:changePage()">';
            } else {
                if ($id == 'edit') {
                    echo '<br>
											<input class="subButton" type="submit" value="Submit" name="Submit">
											&nbsp;&nbsp;
											<input class="backButton" type="button" value="Back" name="Back"
													onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">';
                } else {
                    if ($id == 'view') {
                        echo '<br>
											<input class="backButton" type="button" value="Back" name="Back"
													onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">';
                    } else {
                        if ($id == 'editNew') {
                            echo '<br>
											<input class="subButton" type="submit" value="Submit" name="Submit">
											&nbsp;&nbsp;
											<input class="backButton" type="button" value="Back" name="Back"
													onclick="javascript:changePendViewPage(\'' . $lastUrl . '\')">';
                        } else {
                        }
                    }
                }
            }
            echo '</td>
								</tr>
								<tr>
									<td colspan="2">';
            if ($flag == 'true') {
                echo '<h3>New Post office Saved Successfully</h3>';
            } else {
                if ($flag == 'false') {
                    echo '<h3>PostOffice already exist with the same details</h3>';
                } else {
                    if ($flag == 'success') {
                        echo '<h3>Post office details Updated Successfully</h3>';
                    } else {
                        if ($flag == 'newAdd') {
                            echo '<h3>Pending postoffice Added Successfully</h3>';
                        } else {
                            if ($flag == 'phpValidError') {
                                echo '<h3>Error in given details.Check whether javascript is enabled or check whether you have entered valid details</h3>';
                            } else {
                            }
                        }
                    }
                }
            }
            echo '</td>
								</tr>
							</table>
						</form>
					</td>
				</tr>
			</table>';
        }
    } else {
        echo '<h3>You are not Authorised to view this page</h3>';
    }
}
function showMdlCol($UserType, $flag)
{
    if ($UserType == "GMO" || $UserType == "DAO" || $UserType == "ADMIN") {
        $intCount = 0;
        $resultdist = mysql_query("select * from district") or die(mysql_error());
        while ($rowdist = mysql_fetch_array($resultdist)) {
            $arrDistrict[$intCount] = $rowdist['name'];
            $arrDistrictId[$intCount] = $rowdist['districtid'];
            $intCount++;
        }
        getLastUrl();
        $lastUrl = $_SESSION['lastUrl'];
        $id = "";
        $daoId = 0;
        $name = "";
        $designation = null;
        $address1 = null;
        $address2 = null;
        $phone1 = null;
        $email = "";
        $phone2 = null;
        $mobile = null;
        $user = "";
        $pass = "";
        $districtid = "";
        if ($flag == 'false' || $flag == 'fail' || $flag == 'phpValidError') {
            $name = $_POST['txtName'];
            $designation = $_POST['txtDesignation'];
            $address1 = $_POST['txtAddress1'];
            $address2 = $_POST['txtAddress2'];
            $email = $_POST['txtEmail'];
            $phone1 = $_POST['txtPhone1'];
            $mobile = $_POST['txtMobile'];
            $districtid = $_POST['cmpDistrict'];
            if (isset($_POST['txtUserName'])) {
                $user = $_POST['txtUserName'];
            }
            if (isset($_POST['txtPassword'])) {
                $pass = $_POST['txtPassword'];
            }
        }
        if (isset($_GET['daoid'])) {
            $id = "edit";
            $daoId = $_GET['daoid'];
            $resultDao = mysql_query("SELECT * FROM dao where daoid='{$daoId}'") or die(mysql_error());
            $rowDao = mysql_fetch_array($resultDao);
            $name = $rowDao['name'];
            $designation = $rowDao['designation'];
            $address1 = $rowDao['address1'];
            $address2 = $rowDao['address2'];
            $email = $rowDao['emailid'];
            $phone1 = $rowDao['phonenumber'];
            $mobile = $rowDao['mobilenumber'];
            $districtid = $rowDao['districtid'];
        } else {
            if (isset($_GET['daoViewId'])) {
                $id = "view";
                $daoId = $_GET['daoViewId'];
                $resultDao = mysql_query("SELECT * FROM dao where daoid='{$daoId}'") or die(mysql_error());
                $rowDao = mysql_fetch_array($resultDao);
                $name = $rowDao['name'];
                $user = $rowDao['username'];
                $designation = $rowDao['designation'];
                $address1 = $rowDao['address1'];
                $address2 = $rowDao['address2'];
                $email = $rowDao['emailid'];
                $phone1 = $rowDao['phonenumber'];
                $mobile = $rowDao['mobilenumber'];
                $districtid = $rowDao['districtid'];
            } else {
                if ($UserType == "DAO") {
                    $id = "edit";
                    $daoName = $_SESSION['userName'];
                    $resultDao = mysql_query("SELECT * FROM dao where username='******'") or die(mysql_error());
                    $rowDao = mysql_fetch_array($resultDao);
                    $name = $rowDao['name'];
                    $designation = $rowDao['designation'];
                    $address1 = $rowDao['address1'];
                    $address2 = $rowDao['address2'];
                    $email = $rowDao['emailid'];
                    $phone1 = $rowDao['phonenumber'];
                    $mobile = $rowDao['mobilenumber'];
                    $user = $rowDao['username'];
                    $districtid = $rowDao['districtid'];
                } else {
                    $id = "add";
                }
            }
        }
        if ($flag == 'success') {
            echo '<h3>Updated Successfully</h3>';
        } else {
            echo '	<table class="tblForm">
			<tr>
				<td>';
            if ($id == "edit") {
                echo '<h3>Edit DAO Details</h3>';
            } else {
                if ($id == "view") {
                    echo '<h3>View DAO Details</h3>';
                } else {
                    echo '<h3>DAO Registration</h3>';
                }
            }
            echo '</td>
			</tr>
			<tr>
				<td>';
            if ($id != "view") {
                echo '<i> ( Fields marked with * are compulsary. )</i>';
            }
            echo '<form action="adddao.php"
							onsubmit="javascript:return validateDAOForm(\'' . $id . '\',\'' . $UserType . '\')" method="POST">
					<table class="formTab">
						<tr>
							<td class="formLabel">
								Name';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
							<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $name;
            } else {
                echo '<input type="text" name="txtName" id="txtName"
														maxlength="100" value="' . $name . '" ><br>';
            }
            if ($id != "view") {
                echo '<i> ( Enter Name of the DAO. )</i><br>';
            }
            echo '<div class="dsplyWarning" id="errName">
								</div>
							</td>
						</tr>
						<tr>
							<td class="formLabel">
								Designation';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
							<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $designation;
            } else {
                echo ' <input type="text" name="txtDesignation" id="txtDesignation"
														maxlength="100" value="' . $designation . '"><br> ';
            }
            if ($id != "view") {
                echo '<i> ( Enter designation of the DAO. )</i><br>';
            }
            echo '<div class="dsplyWarning" id="errDesignation">
								</div>
							</td>
						</tr>
						<tr>
							<td class="formLabel">
								Address 1';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
							<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $address1;
            } else {
                echo '<input type="text" name="txtAddress1" id="txtAddress1"
														maxlength="50" value="' . $address1 . '"><br> ';
            }
            if ($id != "view") {
                echo '<i> ( Enter address of the DAO. )</i><br>';
            }
            echo '<div class="dsplyWarning" id="errAddress1">
								</div>
							</td>
						</tr>
						<tr>
							<td class="formLabel">
								Address 2
							</td>
							<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $address2;
            } else {
                echo '<input type="text" name="txtAddress2" id="txtAddress2"
														maxlength="50" value="' . $address2 . '" ';
                echo '><br>';
            }
            echo '<div class="dsplyWarning" id="errAddress2">
								</div>
							</td>
						</tr>
						<tr>
							<td class="formLabel">
								Email Address
							</td>
							<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $email;
            } else {
                echo ' <input type="text" name="txtEmail" id="txtEmail"
														maxlength="30" value="' . $email . '" ';
                echo '><br>';
            }
            echo '<div class="dsplyWarning" id="errEmail">
								</div>
							</td>
						</tr>
						<tr>
							<td class="formLabel">
								Phone Number';
            if ($id != "view") {
                echo ' *';
            }
            echo '</td>
							<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $phone1;
            } else {
                echo '<input type="text" name="txtPhone1" id="txtPhone1"
														maxlength="15" value="' . $phone1 . '"><br> ';
            }
            if ($id != "view") {
                echo ' <i> ( Enter phone number of the DAO. )</i>
										<br>';
            }
            echo '<div class="dsplyWarning" id="errPhoneNumber1">
			 					 </div>
							</td>
						</tr>
						<tr>
							<td class="formLabel">
								Mobile Number
							</td>
							<td class="formContent">';
            if ($id == "view") {
                echo ': ' . $mobile;
            } else {
                echo ' <input type="text" name="txtMobile" id="txtMobile"
														maxlength="15" value="' . $mobile . '" ';
                echo '><br>';
            }
            echo ' <div class="dsplyWarning" id="errMobile">
			 					 </div>
							</td>
						</tr>
						<tr>
							<td class="formLabel">
								District';
            if ($id != "view") {
                echo ' *';
            }
            echo '	</td>
							<td class="formContent">';
            if ($id == "view") {
                for ($intCount = 0; $intCount < count($arrDistrictId); $intCount++) {
                    if ($arrDistrictId[$intCount] == $districtid) {
                        $districtName = $arrDistrict[$intCount];
                        break;
                    }
                }
                echo ': ' . $districtName;
            } else {
                echo '<select name="cmpDistrict" id="cmpDistrict">
										<option selected value="select">--select--</option>';
                for ($intCount = 0; $intCount < count($arrDistrictId); $intCount++) {
                    if ($arrDistrictId[$intCount] == $districtid) {
                        echo '<option selected	value="' . $arrDistrictId[$intCount] . '">' . $arrDistrict[$intCount] . '</option>';
                    } else {
                        echo '<option value="' . $arrDistrictId[$intCount] . '">' . $arrDistrict[$intCount] . '</option>';
                    }
                }
                echo '</select>
									<br>
									<div class="dsplyWarning" id="errDistrict">
				 					 </div>';
            }
            echo '</td>
						</tr>';
            if ($id == "add" || $id == "view" || $UserType == "DAO") {
                echo '	<tr>
								<td class="formLabel">
									UserName';
                if ($id != "view") {
                    echo ' *';
                }
                echo '</td>
								<td class="formContent">';
                if ($id == "edit") {
                    echo ' <input class="noBrdrInput" readonly type="text" name="txtUserName"
											id="txtUserName"	maxlength="25" value="' . $user . '" >';
                } else {
                    if ($id == "view") {
                        echo ' : ' . $user;
                    } else {
                        echo ' <input type="text" name="txtUserName" id="txtUserName"
														maxlength="25"value="' . $user . '" >
												 <br>
												 <i> ( Enter username of the DAO. Username must have 5-25
															 characters. Only alphanumeric characters allowed.
															 Starting letter should be an alphabet. )</i>';
                    }
                }
                echo '<br>
									 <div class="dsplyWarning" id="errUserName">
				 					 </div>
								</td>
							</tr>';
            }
            if ($id == "add" || $UserType == "DAO") {
                echo '<tr>
								<td class="formLabel">
									Password';
                if ($id != "view") {
                    echo ' *';
                }
                echo '</td>
								<td class="formContent">
									 <input type="password" name="txtPassword" id="txtPassword"
															maxlength="25">
									 <br>
									 <i> ( Password must have 5-25 characters. Starting letter should
												 be	an alphabet.)</i>
									 <br>
									 <div class="dsplyWarning" id="errPassword">
									 </div>
								</td>
							</tr>
							<tr>
								<td class="formLabel">
									Retype Password';
                if ($id != "view") {
                    echo ' *';
                }
                echo '	</td>
								<td class="formContent">
								 <input type="password" name="txtRePassword" id="txtRePassword"
															maxlength="25">
									 <br>
									 <div class="dsplyWarning" id="errRePassword">
				 					 </div>
								</td>
							</tr>';
            }
            echo '<tr>
							<td>
								<input type="hidden" name="Id"   id="txtId" value=' . $id . ' >';
            if ($id == 'edit') {
                echo '<input type="hidden" name="daoId"   id="txtDaoId" value=' . $daoId . '>';
            } else {
            }
            echo '	</td>
							<td>';
            if ($id == 'edit' && ($UserType == "GMO" || $UserType == "ADMIN")) {
                echo '<br>
									<input class="subButton" type="submit" value="Submit" name="Submit">
									&nbsp;&nbsp;
									<input class="backButton" type="button" value="Back" name="Back"
											onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">';
            } else {
                if ($id == 'view') {
                    echo '<br>
									<input class="backButton" type="button" value="Back" name="Back"
											onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">';
                } else {
                    echo '<br>
									<input class="subButton" type="submit" value="Submit" name="Submit">
									&nbsp;&nbsp;
									<input class="backButton" type="button" value="Cancel" name="Back"
											onclick="javascript:changePage()">';
                }
            }
            echo '</td>
						</tr>
						<tr>
							<td colspan="2">';
            if ($flag == 'true') {
                echo '<h3>Saved Successfully</h3>';
            } else {
                if ($flag == 'false') {
                    echo '<h3>DAO already exist with the same details</h3>';
                } else {
                    if ($flag == 'fail') {
                        echo '<h3>User Name already exist </h3>';
                    } else {
                        if ($flag == 'phpValidError') {
                            echo '<h3>Error in given details.Check whether javascript is enabled or check whether you have entered valid details</h3>';
                        } else {
                        }
                    }
                }
            }
            echo '	</td>
						</tr>
					</table>
				</form>
			</td>
		</tr>
	</table>';
        }
    } else {
        echo '	<h3>You are not Authorised to view this page </h3>';
    }
}
function showMdlCol($authorise, $blnFlag)
{
    if ($authorise == "GMO" || $authorise == "ADMIN") {
        getLastUrl();
        $lastUrl = $_SESSION['lastUrl'];
        $strDiseaseName = "";
        $strDescription = "";
        $intDiseaseId = "";
        $strSymptoms = "";
        $strPrecautions = "";
        $strSpecialAdvice = "";
        $strMedication = "";
        $strId = "";
        $strSelectImageName = "";
        if ($blnFlag == 'false' || $blnFlag == 'phpValidError') {
            $strDiseaseName = $_POST['txtDiseaseName'];
            $strDescription = $_POST['txtAreaDescription'];
            $strSymptoms = $_POST['txtAreaSymptoms'];
            $strPrecautions = $_POST['txtAreaPrecautions'];
            $strMedication = $_POST['txtAreaMedication'];
            $strSpecialAdvice = $_POST['txtAreaSpecialAdvice'];
            $strSelectImageName = $_POST['strselectImage'];
        }
        if (isset($_GET['intDiseaseId'])) {
            $strId = "edit";
            $intDiseaseId = $_GET['intDiseaseId'];
            $ResultDisease = mysql_query("SELECT * FROM disease where diseaseid='{$intDiseaseId}' ") or die(mysql_error());
            $arrRowDisease = mysql_fetch_array($ResultDisease);
            $strDiseaseName = $arrRowDisease['name'];
            $strDescription = $arrRowDisease['description'];
            $strSymptoms = $arrRowDisease['symptoms'];
            $strPrecautions = $arrRowDisease['precaution'];
            $strMedication = $arrRowDisease['medication'];
            $strSpecialAdvice = $arrRowDisease['specialadvice'];
            $strSelectImageName = $arrRowDisease['imagename'];
        } else {
            if (isset($_GET['intDiseaseViewId'])) {
                $strId = "view";
                $intDiseaseId = $_GET['intDiseaseViewId'];
                $ResultDisease = mysql_query("SELECT * FROM disease where diseaseid='{$intDiseaseId}'") or die(mysql_error());
                $arrRowDisease = mysql_fetch_array($ResultDisease);
                $strDiseaseName = $arrRowDisease['name'];
                $strDescription = $arrRowDisease['description'];
                $strSymptoms = $arrRowDisease['symptoms'];
                $strPrecautions = $arrRowDisease['precaution'];
                $strMedication = $arrRowDisease['medication'];
                $strSpecialAdvice = $arrRowDisease['specialadvice'];
                $strSelectImageName = $arrRowDisease['imagename'];
            } else {
                $strId = "add";
            }
        }
        if ($blnFlag == 'success') {
            echo '<h3>Updated Successfully</h3>';
            include "./creatediseasekml.php";
        } else {
            echo '<table class="tblForm">
				<tr>
					<td>';
            if ($strId == "view") {
                echo '<h3>View Disease Details</h3>';
            } else {
                if ($strId == "edit") {
                    echo '<h3>Edit Disease Details</h3>';
                } else {
                    echo '<h3>Add Disease</h3>';
                }
            }
            echo '</td>
				</tr>
				<tr>
					<td>';
            if ($strId != "view") {
                echo '<i> ( Fields marked with * are compulsary. )</i>';
            }
            echo '<form action="./adddisease.php"
										 name="addDiseaseForm" id="addDiseaseForm"
										 onsubmit="javascript:return validateDiseaseForm()" method="POST">
							<table class="formTab">
								<tr>
									<td class="formLabel">
										Disease Name';
            if ($strId != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($strId != "view") {
                echo '	<input type="text" name="txtDiseaseName" id="txtDiseaseName"
													maxlength="50" value="' . $strDiseaseName . '" >';
            } else {
                echo ': ' . $strDiseaseName;
            }
            if ($strId != "view") {
                echo '<br><i> ( Enter name of the disease. )</i><br>';
            }
            echo '<div class="dsplyWarning" id="errDiseaseName">
										</div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										Image';
            if ($strId != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($strId == "view") {
                echo ': ' . $strSelectImageName;
            } else {
                $arrayImageName = listFolderFiles("../images/diseases");
                echo '<select name="strselectImage" id="selectImageId">';
                echo '<option value="select" >--select--</option>';
                if (count($arrayImageName) != 0) {
                    for ($i = 0; $i < count($arrayImageName); $i++) {
                        if ($arrayImageName[$i] != "") {
                            if ($strSelectImageName == $arrayImageName[$i]) {
                                echo '<option value=' . $arrayImageName[$i] . ' selected="selected" >' . $arrayImageName[$i] . '</option>';
                            } else {
                                echo '<option value=' . $arrayImageName[$i] . ' >' . $arrayImageName[$i] . '</option>';
                            }
                        }
                    }
                }
            }
            if ($strId != "view") {
                echo '</select><br><i> ( Select an image from the list. )</i><br>';
                if (count($arrayImageName) == 0) {
                    echo '<div >
															There is no images in the image folder,Please contact your system admin.
														</div>';
                }
            }
            echo '<div  class="dsplyWarning" id="errImage">
										</div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										Description';
            if ($strId != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($strId != "view") {
                echo '<textarea rows="3" cols="50" name="txtAreaDescription"
												id="txtAreaDescription">' . $strDescription . '</textarea>
												<br><i> ( Enter description about the disease. )
												</i><br>';
            } else {
                echo ': ' . $strDescription;
            }
            echo '<div class="dsplyWarning" id="errDescription">
										</div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										Symptoms';
            if ($strId != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($strId != "view") {
                echo '<textarea rows="3" cols="50" name="txtAreaSymptoms"
														id="txtAreaSymptoms" >' . $strSymptoms . '</textarea>
														<br><i> ( Enter symptoms about the disease. )
														</i><br>';
            } else {
                echo ": " . $strSymptoms;
            }
            echo '<div class="dsplyWarning" id="errSymptoms">
											</div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										Precautions';
            if ($strId != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($strId != "view") {
                echo '<textarea rows="3" cols="50" name="txtAreaPrecautions"
														id="txtAreaPrecautions" >' . $strPrecautions . '</textarea>
														<br><i> ( Enter precautions about the disease. )
														</i><br>';
            } else {
                echo ": " . $strPrecautions;
            }
            echo '<div class="dsplyWarning" id="errPrecautions">
										</div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										Medication';
            if ($strId != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($strId != "view") {
                echo '<textarea rows="3" cols="50" name="txtAreaMedication"
												id="txtAreaMedication" >' . $strMedication . '</textarea>
												<br><i> ( Enter medication about the disease. )
												</i><br>';
            } else {
                echo ": " . $strMedication;
            }
            echo '<div class="dsplyWarning" id="errMedication">
										</div>
									</td>
								</tr>
								<tr>
									<td class="formLabel">
										Special Advice';
            if ($strId != "view") {
                echo ' *';
            }
            echo '</td>
									<td class="formContent">';
            if ($strId != "view") {
                echo '<textarea rows="3" cols="50" name="txtAreaSpecialAdvice"
													id="txtAreaSpecialAdvice" >' . $strSpecialAdvice . '</textarea>
													<br><i> ( Enter special advice about the disease. )
													</i><br>';
            } else {
                echo ": " . $strSpecialAdvice;
            }
            echo '<div class="dsplyWarning" id="errSpecialAdvice">
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<input type="hidden" name="txtId" id="txtId" value="' . $strId . '" >
										<input type="hidden" name="txtDiseaseId" id="txtDiseaseId" value="' . $intDiseaseId . '" >
									</td>
									<td>';
            if ($strId == 'add') {
                echo '<br>
											<input class="subButton" type="submit" value="Submit" name="Submit">
											&nbsp;&nbsp;
											<input class="backButton" type="button" value="Cancel" name="Back"
													onclick="javascript:changePage()">';
            } else {
                if ($strId == 'edit') {
                    echo '<br>
											<input class="subButton" type="submit" value="Submit" name="Submit">
											&nbsp;&nbsp;
											<input class="backButton" type="button" value="Back" name="Back"
													onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">';
                } else {
                    if ($strId == 'view') {
                        echo '<input class="backButton" type="button" value="Back" name="Back"
													onclick="javascript:changeViewPage(\'' . $lastUrl . '\')">';
                    } else {
                    }
                }
            }
            echo '</td>
								</tr>
								<tr>
									<td colspan="2">';
            if ($blnFlag == 'true') {
                echo '<h3>New Disease Saved Successfully</h3>';
                include "./creatediseasekml.php";
            } else {
                if ($blnFlag == 'false') {
                    echo '<h3>Disease already exist with the same details</h3>';
                } else {
                    if ($blnFlag == 'success') {
                        echo '<h3>Disease details Updated Successfully</h3>';
                    } else {
                        if ($blnFlag == 'phpValidError') {
                            echo '<h3>Error in given details.Check whether javascript is enabled or check whether you have entered valid details</h3>';
                        } else {
                            if ($blnFlag == 'image rename false') {
                                echo 'The image name newdisease1.png not exist';
                            } else {
                            }
                        }
                    }
                }
            }
            echo '</td>
								</tr>
							</table>
						</form>
					</td>
				</tr>
			</table>';
        }
    } else {
        echo '<h3>No data is stored in the database or you are not authorised to view this data</h3>';
    }
}