<?php

ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$series = $_SESSION["society_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];

if ($_REQUEST["ctr"]) {
    $ctr = $_REQUEST["ctr"];
    $mctr = $ctr;
    $mctr++;

    Echo "<tr>";
    Echo "<td><i class='fa fa-close remove'></i></td>";
    Echo "<td><input type='text' class='srno form-control  form'     name='srno_$ctr'        value='$mctr'>";
    Echo "<input type='hidden'   class='form-control form subcode'   name='subcode_$ctr'     value=''></td>";
    Echo "<td><input type='text' class='form-control form trname'    name='trname_$ctr'      value=''></td>";
    Echo "<td><input type='text' class='form-control form trname2'    name='trname2_$ctr'      value=''></td>";
    Echo "<td>";
    Echo "<select class='form-control form fetchpart_$ctr trgender select2'  name='trgender_$ctr' style='width:100%'>";
    Echo "<option value='M'>MALE</option>";
    Echo "<option value='F'>FEMALE</option>";
    Echo "</select>";
    Echo "</td>";
    Echo "<td><input type='date' class='form-control form trdob'              name='trdob_$ctr'       value=''></td>";
    Echo "<td><input type='text' class='form-control form trage'              name='trage_$ctr'       value=''></td>";
    Echo "<td><input type='text' class='form-control form trbirthpl'            name='trbirthpl_$ctr'     value=''></td>";
    Echo "<td>";
    Echo "<select class='form-control form trrelation select2 fetchpart_$ctr' name='trrelation_$ctr' style='width:100%'>";
    Echo "<option value='$row[relation]'>$row[relation]</option>";
    $rela1 = mysqli_query($conn, "SELECT code,name FROM $zdb.relation") or die(mysqli_error($conn));
    while ($trp = mysqli_fetch_array($rela1)) {
        echo "<option value='$trp[name]'>$trp[name]</option>";
    }
    Echo "</select>";
    Echo "</td>";
    Echo "<td>";
    Echo "<select class='form-control form fetchpart_$ctr trstatus select2' name='trstatus_$ctr' style='width:100%'>";
    Echo "<option value='M'>MARRIED</option>";
    Echo "<option value='S'>SINGLE</option>";
    Echo "<option value='D'>DIVORCE</option>";
    Echo "<option value='W'>WIDOW</option>";
    Echo "</select>";
    Echo "</td>";
    Echo "<td><input type='number' onKeyPress='if(this.value.length===12) return false;' class='form-control form traadhaar'              name='traadhaar_$ctr'       value=''></td>";
    Echo "<td><input type='text' class='form-control form trmobile'           name='trmobile_$ctr'    value=''></td>";
    Echo "<td><input type='text' class='form-control form trquali'            name='trquali_$ctr'     value=''></td>";
    Echo "<td>";
    Echo "<select class='form-control form trprofess select2 fetchpart_$ctr' name='trprofess_$ctr' style='width:100%'>";
    Echo "<option value='$row[profession]'>$row[profession]</option>";
    $prf1 = mysqli_query($conn, "SELECT code,name FROM $zdb.profession") or die(mysqli_error($conn));
    while ($trel = mysqli_fetch_array($prf1)) {
        echo "<option value='$trel[name]'>$trel[name]</option>";
    }
    Echo "</select>";
    Echo "</td>";
    Echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
?>
 