<?php
ob_start();
$para = $_GET['para'];
if ($para != "C") {
    require("includes/check_auth_user.php");
} else {
    require("includes/check_auth_mem.php");
}
require("includes/dbconnect.php");
include('includes/function.php');

$formname = 'MEMBER';
$maindb = 'member';
$trandb = 'member';
$printfile = "newmempdf.php";
$file = 'member.php';
// $pdffile = 'newmempdf.php';
$keyfld = "accode";

$focusfield = "name";
$mgrpcode = '010';
$usertype = $_SESSION["usertype"];
$username = $_SESSION["username"];

$param = $_GET['param'];
$custcode = $_GET['custcode'];
$famid = $_GET['famid'];

// browse(1);2
$cond = '';

if ($param == "M") {
    $cond = "where accode = '$custcode' ";
}
//if($para == "C"){
//    $cond 
//}

if ($para == "F") {
    $keycond1 = " and `famcheck`= '1'";
    $formname = 'NEW FAMILY ENTRY';
} elseif ($para == "M") {
    $keycond1 = " and `famcheck`!= '1'";
    $formname = 'MEMBER EDIT';
} else {
    $keycond1 = " and `familyid`= '$famid'";
    $formname = 'MEMBER EDIT';
    //    $keyfld = "familyid";
}

$zroot = $_SESSION["zdbroot"];

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zroot);

include("includes/accode_generate.php");
if ($para != "C") {
    include("includes/prev&next.php");
}

if (isset($_POST["submit"])) {

    $a = 1;
    $qvouch = $_POST["accode"];

    $famcheck = $_POST["famcheck"];
    $familyid = $_POST["familyid"];
    $memcode = $_POST["memcode"];

    $surname = $_POST["surname"];
    $name = mysqli_real_escape_string($conn, $_POST["name"]);
    $name2 = mysqli_real_escape_string($conn, $_POST["name2"]);

    $occupation = $_POST["occupation"];
    $add1 = mysqli_real_escape_string($conn, $_POST["add1"]);
    $add2 = mysqli_real_escape_string($conn, $_POST["add2"]);
    $add3 = mysqli_real_escape_string($conn, $_POST["add3"]);
    $city = $_POST["city"];
    $pin = $_POST["pin"];
    $area = $_POST["area"];
    $tel = $_POST["tel"];
    $birthpl = $_POST["birthpl"];
    $mobile = $_POST["mobile"];
    $whatsapp = $_POST["whatsapp"];
    $aadhaar = $_POST["aadhaar"];
    $email = $_POST["email"];
    $dob = $_POST["dob"];
    $age = $_POST["age"];
    $gender = $_POST["gender"];
    $qualification = $_POST["qualification"];
    $profession = $_POST["profession"];
    $mstatus = $_POST["mstatus"];
    $taluka = $_POST["taluka"];
    $village = $_POST["village"];
    $district = $_POST["district"];
    $native = $_POST["native"];
    $image = $_POST["image"];
    $expired = $_POST["expired"];
    $count = $_POST["items"];
    $bsadd1 = mysqli_real_escape_string($conn, $_POST["bsadd1"]);
    $bsadd2 = mysqli_real_escape_string($conn, $_POST["bsadd2"]);
    $bsadd3 = mysqli_real_escape_string($conn, $_POST["bsadd3"]);
    $bsarea = $_POST["bsarea"];
    $bsdistrict = $_POST["bsdistrict"];
    $bstaluka = $_POST["bstaluka"];
    $bsvillage = $_POST["bsvillage"];
    $bspin = $_POST["bspin"];
    $profession1 = $_POST["profession1"];
    $occudtl = $_POST["occudtl"];
    $publishb = $_POST["publishb"];
    $firmname = $_POST["firmname"];
    $bsdescription = $_POST["bsdescription"];
    $approve = $_POST["approve"];
    $zakat = $_POST["zakat"];
    $country = $_POST["country"];
    $phydisabled = $_POST["phydisabled"];
    $phydisabledy = $_POST["phydisabledy"];
    $bloodgrp = $_POST["bloodgrp"];

    $mvouch = $qvouch;

    if ($a == 1) {
        mysqli_query($conn, "LOCK TABLES `$maindb` WRITE") or die(mysqli_error($conn));

        if ($para == 'F') {
            $famcheck = 1;
        } elseif ($para == 'C') {
            $famcheck = $_POST["famcheck"];
            browse($famcheck);
        } else {
            $famcheck = 0;
        }

        if ($addflag == 1) {
            $gen1 = mysqli_query($conn, "SELECT MAX($keyfld) AS maxcode FROM `$maindb` WHERE $keyfld !=''  LIMIT 1 ") or die(mysqli_error($conn));

            if (mysqli_num_rows($gen1) > 0) {
                $vvouch = mysqli_fetch_assoc($gen1);
                $increvouch = $vvouch["maxcode"] + 1;
            } else {
                $increvouch = '1';
            }
            $qvouch = $increvouch;
            $mvouch = $qvouch;

            if ($famcheck == 1) {
                $gen2 = mysqli_query($conn, "SELECT MAX(familyid) AS maxfam FROM `$maindb` WHERE $keyfld != ''  LIMIT 1 ") or die(mysqli_error($conn));

                if (mysqli_num_rows($gen2) > 0) {
                    $fvouch = mysqli_fetch_assoc($gen2);
                    $increfam = $fvouch["maxfam"] + 1;
                } else {
                    $increfam = '1';
                }
                $familyid = $increfam;
            }
        }

        $path = "images/memberimg/";

        #####################IMAGE#####################

        $filename1 = $mvouch . ".jpg";
        $img_file1 = $path . ($filename1);

        $image_ftype = pathinfo($img_file1, PATHINFO_EXTENSION);
        $size = $_FILES['image']['size'];

        if ($size < 300000) {
            move_uploaded_file($_FILES["image"]["tmp_name"], $img_file1);
        } else {
            browse("Image size Should be less then 300kb try again upload image");
            header("refresh: 1; $file?mode=last");
        }


        //        if (!empty($size)) {
        //            $img_file1 = $img_file1;
        //        } else {
        //            $img_file1 = "";
        //        }

        if ($addflag == 1) {
            //Member Only Active in Add Mode as per Fairoz
            mysqli_query($conn, "INSERT INTO `$maindb`(accode, `famcheck`, `familyid`, `memcode`, `surname`, `srno`, `name`, `name2`, `add1`, `add2`, `add3`, `city`, `pin`, `area`, 
                                                      `tel`, `birthpl`, `mobile`, `whatsapp`, `email`,  `aadhaar`, `dob`, `gender`, `qualification`, `occupation`, `profession`, 
                                                      `mstatus`, `image`, `grpcode`, `taluka`, `village`, `district`, `expired`, `native`, `bsadd1`, `bsadd2`, 
                                                      `bsadd3`, `bsarea`,`bsdistrict`, `bstaluka`, `bsvillage`, `bspin`, `profession1`, `occudtl`, `age`, `publishb`, `firmname`, 
                                                      `approve`, `zakat`, `bsdescription`,`adduser`, `country`, `phydisabled`, `phydisabledy`, `bloodgrp`)
                                               VALUES('$mvouch', '1', '$familyid', '$mvouch', '$surname', '0',  '$name', '$name2', '$add1', '$add2', '$add3', '$city', '$pin', '$area',
                                                      '$tel', '$birthpl', '$mobile', '$whatsapp', '$email', '$aadhaar', '$dob',  '$gender', '$qualification', '$occupation', '$profession',
                                                      '$mstatus', '$img_file1', '$mgrpcode', '$taluka', '$village', '$district', '$expired', '$native','$bsadd1',
                                                      '$bsadd2', '$bsadd3', '$bsarea', '$bsdistrict', '$bstaluka', '$bsvillage', '$bspin', '$profession1', '$occudtl', '$age', '$publishb',
                                                      '$firmname', '$approve', '$zakat', '$bsdescription','$username', '$country', '$phydisabled', '$phydisabledy', '$bloodgrp')") or die(mysqli_error($conn));

            //            insmess();
            //            $mvouch = $qvouch;
            //            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        } else {
            //            browse('upd') ;
            //            browse($famcheck) ;

            $mvouch = $qvouch;
            mysqli_query($conn, "UPDATE `$maindb` SET `surname`='$surname', `famcheck`='$famcheck', `familyid`='$familyid', `name`='$name', `name2`='$name2', `add1`='$add1', `add2`='$add2', `add3`='$add3',
                                                      `city`='$city', `pin`='$pin',`area`='$area', `tel`='$tel', `birthpl`='$birthpl', `mobile`='$mobile', `whatsapp`='$whatsapp',`email`='$email', 
                                                      `aadhaar` = '$aadhaar', `dob`='$dob', `gender`='$gender', `qualification`='$qualification', edituser='$username',
                                                      `occupation`='$occupation', `profession`='$profession', `mstatus`='$mstatus', `image`='$img_file1', 
                                                      `grpcode`='$mgrpcode', `taluka`='$taluka', `village`='$village', `district`='$district',
                                                      `expired`='$expired', `native`= '$native', `bsadd1`= '$bsadd1', `bsadd2`= '$bsadd2', `bsadd3`= '$bsadd3',
                                                      `bsarea`= '$bsarea', `bsdistrict`= '$bsdistrict',`bstaluka`= '$bstaluka', `bsvillage`= '$bsvillage', `bspin`= '$bspin',
                                                      `profession1`='$profession1', `occudtl`='$occudtl', `age`='$age', `publishb`='$publishb', `firmname`='$firmname',
                                                      `approve`='$approve', `zakat`='$zakat', `bsdescription`='$bsdescription', `country`='$country', `phydisabled`='$phydisabled',
                                                      `phydisabledy`='$phydisabledy', `bloodgrp`='$bloodgrp'  where accode = '$mvouch'") or die(mysqli_error($conn));
            //            updmess();
            //            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        }


        //        mysqli_query($conn, "DELETE FROM `$maindb` WHERE memcode = '$mvouch' and accode != '$mvouch' ") or die(mysqli_error($conn));

        if ($para == 'F') {

            $ctr = 0;
            for ($i = 0; $i <= $count; $i++) {
                $ctr++;
                $srno = $_POST["srno_$i"];
                $subcode = $_POST["subcode_$i"];
                $trname = $_POST["trname_$i"];
                $trname2 = $_POST["trname2_$i"];

                if ($para == "F") {
                    $trfamcheck = 0;
                    $tfamilyid = $familyid;
                } else {
                    $trfamcheck = $_POST["trfamcheck_$i"];
                    $tfamilyid = $_POST["trfamilyid_$i"];
                }

                $trgender = $_POST["trgender_$i"];
                $trdob = $_POST["trdob_$i"];
                $trage = $_POST["trage_$i"];
                $tremail = $_POST["tremail_$i"];
                $traadhaar = $_POST["traadhaar_$i"];
                $trstatus = $_POST["trstatus_$i"];
                $trmobile = $_POST["trmobile_$i"];
                $trrelation = $_POST["trrelation_$i"];
                $trquali = $_POST["trquali_$i"];
                $trprofess = $_POST["trprofess_$i"];
                $trbirthpl = $_POST["trbirthpl_$i"];

                if ($trfamcheck == 1) {
                    $trfamilyid = $tfamilyid;
                } else {
                    $trfamilyid = $familyid;
                }

                if ($trname != '') {
                    if (empty($subcode) || $subcode == '' || $subcode == 0) {
                        $gen2 = mysqli_query($conn, "SELECT MAX($keyfld) AS maxcode FROM `$maindb` WHERE $keyfld !=''  LIMIT 1 ") or die(mysqli_error($conn));

                        if (mysqli_num_rows($gen2) > 0) {
                            $svouch = mysqli_fetch_assoc($gen2);
                            $subcode = $svouch["maxcode"] + 1;
                        } else {
                            $subcode = '1';
                        }


                        if ($srno == 0) {
                            $srno = 1;
                        }

                        mysqli_query($conn, "INSERT INTO `$maindb`(accode, `famcheck`, `familyid`, `memcode`, `surname`, `srno`, `name`, `name2`, `add1`, `add2`, `add3`, 
                                                      `city`, `pin`, `area`, `tel`, `email`, `aadhaar`, 
                                                      `mobile`, `dob`,  `gender`, `qualification`, `profession`, `mstatus`, `relation`,
                                                      `grpcode`, `taluka`, `village`, `district`, `age`, `birthpl`, `approve`, adduser )
                                               VALUES('$subcode', '$trfamcheck', '$trfamilyid', '$mvouch', '$surname', '$ctr', '$trname', '$trname2', '$add1', '$add2', '$add3', 
                                                       '$city', '$pin', '$area', '$tel', '$tremail', '$traadhaar',
                                                       '$trmobile', '$trdob', '$trgender', '$trquali', '$trprofess', '$trstatus', '$trrelation', 
                                                       '$mgrpcode', '$taluka', '$village', '$district', '$trage', '$trbirthpl', '$approve','$username')") or die(mysqli_error($conn));
                    } else {
                        mysqli_query($conn, "UPDATE `$maindb` SET `name`='$trname',`name2`='$trname2',  `srno`='$ctr', `birthpl`='$trbirthpl', `mobile`='$trmobile', approve = '$approve', 
                                                      `aadhaar` = '$traadhaar', `dob`='$trdob', `gender`='$trgender', `qualification`='$trquali',
                                                      `profession`='$trprofess', `mstatus`='$trstatus', `relation`='$trrelation', edituser='$username',
                                                      `grpcode`='$mgrpcode', `age`='$trage' where accode = '$subcode'") or die(mysqli_error($conn));
                    }
                }
            }
        }


        if ($addflag == 1 && $famcheck == 1) {
            $user = "tamboli2013";
            $password = "tamboli2013";
            $senderid = "AITJMS";
            $url = "http://vas.mobilogi.com/api.php?";

            $mobilenumbers = $mobile;

            $msgtech = "Congrats!! You are now registered at A I Tamboliyan Jamat M.S. Your Famiy ID is $familyid & Login Member Id is $mvouch. For more details wa.me/+917607600906 Website www.tambolijamatmaha.org";

            $messagetech = urlencode($msgtech);

            $chtech = curl_init();
            if (!$chtech) {
                die("Couldn't initialize a cURL handle");
            }
            $rettech = curl_setopt($chtech, CURLOPT_URL, $url);
            curl_setopt($chtech, CURLOPT_POST, 1);
            curl_setopt($chtech, CURLOPT_POSTFIELDS, "username=$user&password=$password&route=1&sender=$senderid&mobile[]=$mobilenumbers&message[]=$messagetech&templateid=1207167094034116906");

            $rettech = curl_setopt($chtech, CURLOPT_RETURNTRANSFER, true);

            $curlresponsetech = curl_exec($chtech);
            if (curl_errno($chtech)) {
                //        echo 'curl error : ' . curl_error($chtech);
            }
            if (empty($rettech)) {

                die(curl_error($chtech));
                curl_close($chtech);
            } else {
                $infotech = curl_getinfo($chtech);
                curl_close($chtech);

                $success = true;
            }
        }

        if ($addflag == 1) {
            insmess();
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit&para=$para");
        } else {
            updmess();
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit&para=$para");
        }
        mysqli_query($conn, "UNLOCK TABLES");
    }
}

if ($addflag != 1) {
    $getvouch = '';
    if ($addflag == 0) {
        $getvouch = $_GET[$keyfld];
    } else {
        $getvouch = $qvouch;
    }
    $mvouch = $getvouch;

    if ($param == "M") {
        $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld = '$mvouch' ") or die(mysqli_error($conn));
    } elseif ($para == "C" && $famid != "") {
        $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld = '$famid' ") or die(mysqli_error($conn));
    } else {
        $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld = '$mvouch' ") or die(mysqli_error($conn));
    }


    $get = mysqli_fetch_array($result);
    $talukat = $get['taluka'];

    $rd = "readonly";
} else {
    $resulto = mysqli_query($conn, "SELECT * FROM `$maindb` order by $keyfld DESC limit 1") or die(mysqli_error($conn));
    if (mysqli_num_rows($resulto) > 0) {
        $get2 = mysqli_fetch_array($resulto);
        $talukat = $get2['taluka'];
    }
}

if (isset($_GET["delete"])) {

    $imgfile = "images/memberimg/" . $_GET[$keyfld] . ".jpg";

    unlink($imgfile);
    delete($zroot, "$maindb", "$keyfld", $_GET[$keyfld], "$file?mode=last&para=$para");
    //        mysqli_query($conn, "Delete From $zroot.`passmain`  WHERE `custcode` = '$_GET[$keyfld]' and series = '$series' and usertype=3") or die(mysqli_error($conn));
}

include("includes/linkshead.php");
?>

<style>
    .tab {
        border: 1px solid #6082BF;
        color: black;
        background-color: white;
    }
</style>
<script src="MyScript/member.js?a=3" type="text/javascript"></script>
<script src="MyScript/member_search.js" type="text/javascript"></script>
</head>

<body>
    <!--    <div id="preloader" class="col-lg-12 text-center">
            <h3 class="text-center">Loading</h3>
            <div id="status">&nbsp;</div>
        </div>-->
    <form action='' method='POST' enctype="multipart/form-data">
        <!-- Default box -->
        <div>
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12  pad">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><?php echo $formname; ?></h3>

                    </div>

                    <div class="panel-body">
                        <div class="col-lg-10 col-md-1 col-sm-4 col-xs-4 pad">
                            <div class="row">
                                <input type="hidden" class="form-control form usertype" name="usertype" value="<?php echo $usertype; ?>">

                                <?php if ($para == 'F') { ?>

                                    <div class="col-lg-1 col-md-1 col-sm-4 col-xs-4 text-right pad">
                                        <label class="label-control marg" style="color:#A8B87C">Family ID</label>
                                    </div>
                                    <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 pad">
                                        <input type="text" class="form-control form familyid" id="familyid" name="familyid" value="<?php echo ($addflag != 1) ? $get["familyid"] : "NEW"; ?>" readonly>
                                    </div>
                                    <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 pad">
                                        <input type="hidden" class="form-control form memcode" id="memcode" name="memcode" value="<?php echo ($addflag != 1) ? $get["memcode"] : ""; ?>" readonly>
                                    </div>

                                    <div class="col-lg-1 col-md-1 col-sm-4 col-xs-4 text-right pad">
                                        <label class="label-control marg">Member No.</label>
                                    </div>
                                    <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 pad">
                                        <input type="text" class="form-control form accode" name="accode" value="<?php echo ($addflag != 1) ? $get["accode"] : "NEW"; ?>" readonly>
                                        <input type="hidden" class="form-control form para" name="para" value="<?php echo $para; ?>">
                                        <input type="hidden" class="form-control form famcheck" name="famcheck" value="<?php echo ($addflag != 1) ? $get["famcheck"] : "$famcheck"; ?>">
                                    </div>

                                <?php } ?>

                                <?php if ($para == 'M' || $para == "C") { ?>
                                    <div class="col-lg-1 col-md-1 col-sm-4 col-xs-4 text-right pad">
                                        <label class="label-control marg">Member No.</label>
                                    </div>
                                    <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 pad">
                                        <input type="text" class="form-control form accode" name="accode" value="<?php echo ($addflag != 1) ? $get["accode"] : "$mvouch"; ?>" readonly>
                                        <input type="hidden" class="form-control form para" name="para" value="<?php echo $para; ?>">
                                        <input type="hidden" class="form-control form famcheck" name="famcheck" value="<?php echo ($addflag != 1) ? $get["famcheck"] : "$famcheck"; ?>">
                                    </div>

                                    <div class="col-lg-1 col-md-1 col-sm-4 col-xs-4 text-right pad">
                                        <label class="label-control marg">Family No.</label>
                                    </div>
                                    <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 pad">
                                        <input type="text" class="form-control form familyid" id="familyid" name="familyid" value="<?php echo ($addflag != 1) ? $get["familyid"] : ""; ?>" readonly>
                                    </div>
                                    <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 pad">
                                        <input type="hidden" class="form-control form memcode" id="memcode" name="memcode" value="<?php echo ($addflag != 1) ? $get["memcode"] : ""; ?>" readonly>
                                    </div>
                                <?php } ?>

                                <div class="row">
                                    <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                        <label class="label-control marg">Surname</label>
                                    </div>
                                    <div class="col-lg-2 col-md-1 col-sm-8 col-xs-8 pad">
                                        <!-- <input type="text" class="form-control text-uppercase form focusfield" name="surname" value="<?php echo ($addflag != 1) ? $get["surname"] : ""; ?>" autofocus> -->

                                        <input list='surname' name='surname' value="<?php echo ($addflag != 1) ? $get['surname'] : '' ?>" class='surname form-control text-uppercase form focusfield' autocomplete="off" autofocus>
                                        <datalist id='surname' char="#">
                                            <option value=''></option>
                                            <?php
                                            $mname = mysqli_query($conn, "SELECT `surname` FROM $zroot.`member`  group by surname  order by surname") or die(mysqli_error($conn));

                                            while ($tname = mysqli_fetch_array($mname)) {
                                                $surname = $tname['surname'];
                                                echo "<option value='$surname'>";
                                            }
                                            ?>
                                        </datalist>
                                    </div>
                                    <?php if ($usertype == 1) { ?>
                                        <div class="col-lg-1 col-md-1 col-sm-4 col-xs-4 text-right pad">
                                            <label class="label-control marg" style="color:red">Approve</label>
                                        </div>
                                        <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 pad">
                                            <input type="checkbox" class="form-control form approve" id="approve" name="approve" value="1" <?php
                                            if ($get["approve"] == 1) {
                                                echo "checked";
                                            }
                                            ?> readonly>
                                        </div>
                                    <?php } ?>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Name</label>
                                </div>
                                <div class="col-lg-5 col-md-1 col-sm-8 col-xs-8 pad">
                                    <input type="text" class="form-control text-uppercase form name" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>" required>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Father/Husband</label>
                                </div>
                                <div class="col-lg-5 col-md-1 col-sm-8 col-xs-8 pad">
                                    <input type="text" class="form-control text-uppercase form name2" name="name2" value="<?php echo ($addflag != 1) ? $get["name2"] : ""; ?>">
                                </div>

                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Birth Place</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad" style="background:lightblue">
                                    <input type="text" class="form-control form birthpl" name="birthpl" value="<?php echo ($addflag != 1) ? $get["birthpl"] : ""; ?>">
                                </div>
                                <!--                                    <div class="col-lg-2 col-md-1 col-sm-4 col-xs-4 text-right pad">
                                                                        <label class="label-control marg">Liable For Zakaat</label>
                                                                    </div>
                                                                    <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 pad">
                                                                        <input type="checkbox" class="form-control form zakat" id="zakat" name="zakat" value="1" <?php
                                if ($get["zakat"] == 1) {
                                    echo "checked";
                                }
                                ?> readonly>
                                                                    </div>-->
                            </div>

                            <div class="row">
                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Gender</label>
                                </div>
                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad">
                                    <select name="gender" class="form-control form sex select2" >
                                        <option value="<?php echo ($addflag != 1) ? $get['gender'] : "M"; ?>"><?php echo ($addflag != 1) ? $get['gender'] : "MALE"; ?></option>
                                        <option <?php
                                        if ($get['gender'] == 'M') {
                                            echo "selected=selected";
                                        }
                                        ?> value='M'>MALE</option>
                                        <option <?php
                                        if ($get['gender'] == 'F') {
                                            echo "selected=selected";
                                        }
                                        ?> value='F'>FEMALE</option>
                                    </select>
                                </div>

                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Date Of Birth</label>
                                </div>
                                <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad" >
                                    <input type="date" class="form-control form dob" name="dob" value="<?php echo ($addflag != 1) ? $get["dob"] : ""; ?>" style="width:170px">
                                </div>

                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Age</label>
                                </div>
                                <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                    <input type="text" class="form-control form age" name="age" value="<?php echo ($addflag != 1) ? $get["age"] : ""; ?>" >
                                </div>

                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Married Status</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <select name="mstatus" class="form-control form mstatus select2" style="width:100%">
                                        <option value="<?php echo ($addflag != 1) ? $get['mstatus'] : ""; ?>"><?php echo ($addflag != 1) ? $get['mstatus'] : ""; ?></option>
                                        <option <?php
                                        if ($get['mstatus'] == 'M') {
                                            echo "selected=selected";
                                        }
                                        ?> value='M'>MARRIED</option>
                                        <option <?php
                                        if ($get['mstatus'] == 'S') {
                                            echo "selected=selected";
                                        }
                                        ?> value='S'>SINGLE</option>
                                        <option <?php
                                        if ($get['mstatus'] == 'D') {
                                            echo "selected=selected";
                                        }
                                        ?> value='D'>DIVORCE</option>
                                        <option <?php
                                        if ($get['mstatus'] == 'W') {
                                            echo "selected=selected";
                                        }
                                        ?> value='W'>WIDOW</option>
                                    </select>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Aadhaar No.</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <input type="number" onKeyPress="if (this.value.length === 12)
                                                return false;" class="form-control form aadhaar" name="aadhaar" value="<?php echo ($addflag != 1) ? $get["aadhaar"] : ""; ?>">
                                </div>
                            </div>



                            <div class="row">

                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">State</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <select name="area" class="form-control form  select2 area">
                                        <option value="<?php echo ($addflag != 1) ? $get['area'] : "$get2[area]"; ?>"><?php echo ($addflag != 1) ? $get['area'] : "$get2[area]"; ?></option>
                                        <!--<option value=""></option>-->
                                        <?php
                                        $getstate = mysqli_query($conn, "SELECT state FROM $zdb.disttaluka group by state order by state") or die(mysqli_error($conn));
                                        while ($strow1 = mysqli_fetch_array($getstate)) {
                                            echo "<option value='$strow1[state]'>$strow1[state]</option>";
                                        }
                                        ?>
                                    </select>
                                </div>
                                <div class="col-lg-1 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                    <label class="label-control marg">District</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <select name="district" class="form-control form  select2 district">
                                        <option value="<?php echo ($addflag != 1) ? $get['district'] : "$get2[district]"; ?>"><?php echo ($addflag != 1) ? $get['district'] : "$get2[district]"; ?></option>
                                        <option value=""></option>
                                        <?php
                                        $getdistrict = mysqli_query($conn, "SELECT district FROM $zdb.disttaluka group by district ") or die(mysqli_error($conn));
                                        while ($dtrow1 = mysqli_fetch_array($getdistrict)) {
                                            echo "<option value='$dtrow1[district]'>$dtrow1[district]</option>";
                                        }
                                        ?>
                                    </select>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Area</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <?php
                                    echo "<input list='taluka' name='taluka' class='taluka form-control form ' autocomplete='off' value='$talukat'> ";
                                    echo "<datalist id='taluka' char='#'>";
                                    echo"<option>";

                                    $msi = mysqli_query($conn, "SELECT `taluka` FROM `member` group by taluka") or die(mysqli_error($conn));

                                    while ($tsi = mysqli_fetch_array($msi)) {
                                        $szname = $tsi['taluka'];
                                        echo "<option value='$szname'>";
                                    }
                                    echo "</datalist>";
                                    ?>

                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">City/Village</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <input type="text" class="form-control form village " name="village" value="<?php echo ($addflag != 1) ? $get["village"] : $get2["village"]; ?>">
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Address</label>
                                </div>
                                <div class="col-lg-5 col-md-2 col-sm-2 col-xs-2 pad">
                                    <input type="text" class="form-control form add1" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg"></label>
                                </div>
                                <div class="col-lg-5 col-md-2 col-sm-2 col-xs-2 pad">
                                    <input type="text" class="form-control form add2" name="add2" value="<?php echo ($addflag != 1) ? $get["add2"] : ""; ?>">
                                </div>

                            </div>
                            <div class="row">
                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg"></label>
                                </div>
                                <div class="col-lg-5 col-md-2 col-sm-2 col-xs-2 pad">
                                    <input type="text" class="form-control form add3" name="add3" value="<?php echo ($addflag != 1) ? $get["add3"] : ""; ?>">
                                </div>

                            </div>

                            <div class="row">

                                <div class="col-lg-1 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                    <label class="label-control marg">Pin</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2  pad">
                                    <input type="text" class="form-control form pin" name="pin" value="<?php echo ($addflag != 1) ? $get["pin"] : $get2["pin"]; ?>">
                                </div>
                                <div class="col-lg-1 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                    <label class="label-control marg">Native</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2  pad">
                                    <input type="text" class="form-control form native" name="native" value="<?php echo ($addflag != 1) ? $get["native"] : ""; ?>">
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Country</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <input type="text" class="form-control form country " name="country" value="<?php echo ($addflag != 1) ? $get["country"] : "INDIA"; ?>">
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Mobile</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <input type="text" class="form-control form mobile" name="mobile" value="<?php echo ($addflag != 1) ? $get["mobile"] : ""; ?>">
                                </div>

                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Whatsapp</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <input type="text" class="form-control form whatsapp" name="whatsapp" value="<?php echo ($addflag != 1) ? $get["whatsapp"] : ""; ?>">
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Tel</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <input type="text" class="form-control form tel " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                </div>

                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Blood Group </label>
                                </div>
                                <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                    <select name="bloodgrp" class="form-control form bloodgrp select2">
                                        <option value="<?php echo ($addflag != 1) ? $get['bloodgrp'] : ""; ?>"><?php echo ($addflag != 1) ? $get['bloodgrp'] : ""; ?></option>
                                        <option <?php
                                        if ($get['bloodgrp'] == 'A+') {
                                            echo "selected=selected";
                                        }
                                        ?> value='A+'>A+</option>
                                        <option <?php
                                        if ($get['bloodgrp'] == 'O+') {
                                            echo "selected=selected";
                                        }
                                        ?> value='O+'>O+</option>
                                        <option <?php
                                        if ($get['bloodgrp'] == 'B+') {
                                            echo "selected=selected";
                                        }
                                        ?> value='B+'>B+</option>
                                        <option <?php
                                        if ($get['bloodgrp'] == 'AB+') {
                                            echo "selected=selected";
                                        }
                                        ?> value='AB+'>AB+</option>
                                        <option <?php
                                        if ($get['bloodgrp'] == 'A-') {
                                            echo "selected=selected";
                                        }
                                        ?> value='A-'>A-</option>
                                        <option <?php
                                        if ($get['bloodgrp'] == 'O-') {
                                            echo "selected=selected";
                                        }
                                        ?> value='O-'>O-</option>
                                        <option <?php
                                        if ($get['bloodgrp'] == 'B-') {
                                            echo "selected=selected";
                                        }
                                        ?> value='B-'>B-</option>
                                        <option <?php
                                        if ($get['bloodgrp'] == 'AB-') {
                                            echo "selected=selected";
                                        }
                                        ?> value='AB-'>AB-</option>
                                    </select>
                                </div>

                            </div>

                            <div class="row">
                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Email</label>
                                </div>
                                <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                    <input type="text" class="form-control form " name="email" value="<?php echo ($addflag != 1) ? $get["email"] : ""; ?>">
                                </div>

                                <div class="col-lg-2 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Physically Disabled</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                    <select name="phydisabled" class="form-control form phydisabled select2" style="width:100%">
                                        <!-- <option value=""></option> -->
                                        <option <?php
                                        if ($get['phydisabled'] == 'NO') {
                                            echo "selected=selected";
                                        }
                                        ?> value='NO'>NO</option>
                                        <option <?php
                                        if ($get['phydisabled'] == 'YES') {
                                            echo "selected=selected";
                                        }
                                        ?> value='YES'>YES</option>
                                    </select>
                                </div>


                                <?php
                                if ($get['phydisabled'] == 'YES') {
                                    ?>
                                    <div id="phydis">
                                    <?php } else { ?>
                                        <div id="phydis" style="display:none">
                                        <?php } ?>

                                        <div class="col-lg-3 col-md-2 col-sm-2 col-xs-2 pad">
                                            <select name="phydisabledy" class="form-control form phydisabledy select2" style="width:100%">
                                                <option value=""></option>
                                                <option <?php
                                                if ($get['phydisabledy'] == 'Deaf') {
                                                    echo "selected=selected";
                                                }
                                                ?> value='Deaf'>Deaf</option>
                                                <option <?php
                                                if ($get['phydisabledy'] == 'Blindness') {
                                                    echo "selected=selected";
                                                }
                                                ?> value='Blindness'>Blindness</option>
                                                <option <?php
                                                if ($get['phydisabledy'] == 'Mental Illness') {
                                                    echo "selected=selected";
                                                }
                                                ?> value='Mental Illness'>Mental Illness</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-lg-1 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                        <label class="label-control marg">Qualification</label>
                                    </div>
                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2  pad">
                                        <select name="qualification" class="form-control form  select2 qualification">
                                            <option value="<?php echo ($addflag != 1) ? $get['qualification'] : ""; ?>"><?php echo ($addflag != 1) ? $get['qualification'] : ""; ?></option>
                                            <option value=""></option>
                                            <?php
                                            $mown1 = mysqli_query($conn, "SELECT code,name FROM $zdb.qualified order by name") or die(mysqli_error($conn));
                                            while ($trow = mysqli_fetch_array($mown1)) {
                                                echo "<option value='$trow[name]'>$trow[name]</option>";
                                            }
                                            ?>
                                        </select>
                                        <!-- <input type="text" class="form-control form" name="qualification" value="<?php echo ($addflag != 1) ? $get["qualification"] : ""; ?>"> -->
                                    </div>

                                    <div class="col-lg-1 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                        <label class="label-control marg">Occupation</label>
                                    </div>
                                    <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3  pad">
                                        <select name="occupation" class="form-control form  select2 occupation">
                                            <option value="<?php echo ($addflag != 1) ? $get['occupation'] : ""; ?>"><?php echo ($addflag != 1) ? $get['occupation'] : ""; ?></option>
                                            <option value=""></option>
                                            <?php
                                            $mown = mysqli_query($conn, "SELECT code,name FROM $zdb.occupation") or die(mysqli_error($conn));
                                            while ($trow1 = mysqli_fetch_array($mown)) {
                                                echo "<option value='$trow1[name]'>$trow1[name]</option>";
                                            }
                                            ?>
                                        </select>
                                    </div>

                                    <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                        <label class="label-control marg">Profession</label>
                                    </div>
                                    <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3  pad">
                                        <select name="profession" class="form-control form  select2 profession">
                                            <option value="<?php echo ($addflag != 1) ? $get['profession'] : ""; ?>"><?php echo ($addflag != 1) ? $get['profession'] : ""; ?></option>
                                            <?php
                                            $mown1 = mysqli_query($conn, "SELECT code,name FROM $zdb.profession order by name") or die(mysqli_error($conn));
                                            while ($trow = mysqli_fetch_array($mown1)) {
                                                echo "<option value='$trow[name]'>$trow[name]</option>";
                                            }
                                            ?>
                                        </select>
                                    </div>

                                    <?php
                                    if ($get['profession'] == 'Other') {
                                        ?>
                                        <div id="profsdtl">
                                        <?php } else { ?>
                                            <div id="profsdtl" style="display:none">
                                            <?php } ?>

                                            <div class="col-lg-3 col-md-2 col-sm-2 col-xs-2 pad">
                                                <input type="text" class="form-control form profession1" name="profession1" value="<?php echo ($addflag != 1) ? $get["profession1"] : ""; ?>">
                                            </div>
                                        </div>
                                    </div>

                                    <?php
                                    if ($get['occupation'] == 'Business') {
                                        ?>
                                        <div id="businessdtl">
                                        <?php } else { ?>
                                            <div id="businessdtl" style="display:none">
                                            <?php } ?>
                                            <!--<hr>-->
                                            <div class="row">
                                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">Firm Name</label>
                                                </div>
                                                <div class="col-lg-5 col-md-2 col-sm-3 col-xs-3 pad">
                                                    <input type="text" class="form-control form firmname" name="firmname" value="<?php echo ($addflag != 1) ? $get["firmname"] : ""; ?>">
                                                </div>
                                                <!--                                        </div>
                                                                                <div class="row">-->
                                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">Description</label>
                                                </div>
                                                <div class="col-lg-5 col-md-2 col-sm-3 col-xs-3 pad">
                                                    <input type="text" class="form-control form bsdescription" name="bsdescription" value="<?php echo ($addflag != 1) ? $get["bsdescription"] : ""; ?>">
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">State</label>
                                                </div>
                                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                                    <select name="bsarea" class="form-control form  select2 bsarea" style="width:100%">
                                                        <option value="<?php echo ($addflag != 1) ? $get['bsarea'] : ""; ?>"><?php echo ($addflag != 1) ? $get['bsarea'] : ""; ?></option>
                                                        <option value=""></option>
                                                        <?php
                                                        $getbsstate = mysqli_query($conn, "SELECT state FROM $zdb.disttaluka group by state order by state") or die(mysqli_error($conn));
                                                        while ($bstrow1 = mysqli_fetch_array($getbsstate)) {
                                                            echo "<option value='$bstrow1[state]'>$bstrow1[state]</option>";
                                                        }
                                                        ?>
                                                    </select>
                                                </div>
                                                <div class="col-lg-1 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">District</label>
                                                </div>
                                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                                    <select name="bsdistrict" class="form-control form  select2 bsdistrict" style="width:100%">
                                                        <option value="<?php echo ($addflag != 1) ? $get['bsdistrict'] : ""; ?>"><?php echo ($addflag != 1) ? $get['bsdistrict'] : ""; ?></option>
                                                        <option value=""></option>
                                                        <?php
                                                        $getbsdistrict = mysqli_query($conn, "SELECT district FROM $zdb.disttaluka group by district order by district") or die(mysqli_error($conn));
                                                        while ($bsdtrow1 = mysqli_fetch_array($getbsdistrict)) {
                                                            echo "<option value='$bsdtrow1[district]'>$bsdtrow1[district]</option>";
                                                        }
                                                        ?>
                                                    </select>
                                                </div>
                                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">Taluka</label>
                                                </div>
                                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                                    <select name="bstaluka" class="form-control form  select2 bstaluka" style="width:100%">
                                                        <option value="<?php echo ($addflag != 1) ? $get['bstaluka'] : ""; ?>"><?php echo ($addflag != 1) ? $get['bstaluka'] : ""; ?></option>
                                                        <option value=""></option>
                                                        <?php
                                                        $getbstaluka = mysqli_query($conn, "SELECT taluka FROM $zdb.disttaluka group by taluka order by taluka") or die(mysqli_error($conn));
                                                        while ($bsttrow1 = mysqli_fetch_array($getbstaluka)) {
                                                            echo "<option value='$bsttrow1[taluka]'>$bsttrow1[taluka]</option>";
                                                        }
                                                        ?>
                                                    </select>
                                                </div>
                                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">City/Village</label>
                                                </div>
                                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                                    <input type="text" class="form-control form bsvillage" name="bsvillage" value="<?php echo ($addflag != 1) ? $get["bsvillage"] : ""; ?>">
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">Address</label>
                                                </div>
                                                <div class="col-lg-5 col-md-2 col-sm-2 col-xs-2 pad">
                                                    <input type="text" class="form-control form bsadd1" name="bsadd1" value="<?php echo ($addflag != 1) ? $get["bsadd1"] : ""; ?>">
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg"></label>
                                                </div>
                                                <div class="col-lg-5 col-md-2 col-sm-2 col-xs-2 pad">
                                                    <input type="text" class="form-control form bsadd2" name="bsadd2" value="<?php echo ($addflag != 1) ? $get["bsadd2"] : ""; ?>">
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg"></label>
                                                </div>
                                                <div class="col-lg-5 col-md-2 col-sm-2 col-xs-2 pad">
                                                    <input type="text" class="form-control form bsadd3" name="bsadd3" value="<?php echo ($addflag != 1) ? $get["bsadd3"] : ""; ?>">
                                                </div>

                                                <div class="col-lg-1 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">Pin</label>
                                                </div>
                                                <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                                    <input type="text" class="form-control form bspin" name="bspin" value="<?php echo ($addflag != 1) ? $get["bspin"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                                    <label class="label-control marg" style="color:#b91747">Want To Publish Business</label>
                                                </div>
                                                <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 pad">
                                                    <select name="publishb" class="form-control form publishb select2">
                                                        <option value="<?php echo ($addflag != 1) ? $get['publishb'] : ""; ?>"><?php echo ($addflag != 1) ? $get['publishb'] : ""; ?></option>
                                                        <option <?php
                                                        if ($get['publishb'] == 'YES') {
                                                            echo "selected=selected";
                                                        }
                                                        ?> value='YES'>YES</option>
                                                        <option <?php
                                                        if ($get['publishb'] == 'NO') {
                                                            echo "selected=selected";
                                                        }
                                                        ?> value='NO'>NO</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>

                                        <?php
                                        if ($get['occupation'] == 'Govt Service') {
                                            ?>
                                            <div id="occudept">
                                            <?php } else { ?>
                                                <div id="occudept" style="display:none">
                                                <?php } ?>
                                                <div class="row">
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg"></label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                                        <!--<input type="text" class="form-control form " name="bsadd3" value="<?php echo ($addflag != 1) ? $get["bsadd3"] : ""; ?>">-->
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg" style="color:#b91747">Department</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                                        <input type="text" class="form-control form occudtl" name="occudtl" value="<?php echo ($addflag != 1) ? $get["occudtl"] : ""; ?>">
                                                    </div>
                                                </div>
                                            </div>


                                        </div>

                                        <div class="col-lg-2 col-md-2 col-sm-9 col-xs-9 text-right pad">
                                            <div class="row">
                                                <div class="col-lg-1 col-md-1 col-sm-4 col-xs-4 pad" style="padding-left: 40px;">
                                                    <input type="file" class="btn btn-warning form image" name="image" id="image">
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-1 col-md-1 col-sm-5 col-xs-5 pad" style="padding-left: 40px;">
                                                    <img class="view1" src="<?php echo ($addflag != 1) ? $get['image'] . "?a=" . mt_rand() : "" ?>" style="border: #E7B315 solid 1px; width: 210px;height: 210px" alt="Image" />
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                    <?php if ($para == 'F') { ?>

                                        <div class="table-responsive">
                                            <table class="table-striped table-condensed table-bordered tab" width="100%">
                                                <thead class="mySearchTr">
                                                    <tr>
                                                        <th style="width: 1%"></th>
                                                        <th style="width: 2%" class="text-left">Sr.</th>
                                                        <th style='width: 8%' class="text-left">Name</th>
                                                        <th style='width: 7%' class="text-left">Father/Husband</th>
                                                        <th style='width: 3%' class="text-left">Gender</th>
                                                        <th style='width: 4%' class="text-left">DOB</th>
                                                        <th style='width: 3%' class="text-left">Age</th>
                                                        <th style='width: 5%' class="text-left">Birth Place</th>
                                                        <th style='width: 7%' class="text-left">Relationship</th>
                                                        <th style='width: 3%' class="text-left">Status</th>
                                                        <th style='width: 6%' class="text-left">Aadhaar</th>
                                                        <th style='width: 5%' class="text-left">Mobile</th>
                                                        <th style='width: 7%' class="text-left">Qualification</th>
                                                        <th style='width: 7%' class="text-left">Profession</th>

                                                    </tr>
                                                </thead>
                                                <tbody class="tbody">
                                                    <?php
                                                    if ($addflag != 1) {

                                                        $qry = mysqli_query($conn, "SELECT * FROM  `$maindb` WHERE memcode = '$mvouch' and accode != '$mvouch' order by srno") or die(mysqli_error($conn));
//                                                                                                        print table($qry);
                                                        $ctr = 0;
                                                        while ($row = mysqli_fetch_array($qry)) {


                                                            $name = $row['name'];
                                                            $name2 = $row['name2'];

                                                            if ($row['gender'] == "M") {
                                                                $trgender = "MALE";
                                                            } elseif ($row['gender'] == "F") {
                                                                $trgender = "FEMALE";
                                                            } else {
                                                                $trgender = "";
                                                            }

                                                            if ($row['mstatus'] == "M") {
                                                                $trstatus = "MARRIED";
                                                            } elseif ($row['mstatus'] == "S") {
                                                                $trstatus = "SINGLE";
                                                            } elseif ($row['mstatus'] == "D") {
                                                                $trstatus = "DIVORCE";
                                                            } elseif ($row['mstatus'] == "W") {
                                                                $trstatus = "WIDOW";
                                                            } else {
                                                                $trstatus = "";
                                                            }

                                                            echo "<tr>";
                                                            echo "<td><i class='fa fa-close remove' style='display:none;'></i></td>";
                                                            echo "<td><input type='text' class='srno  form-control  form'   name='srno_$ctr'        value='$row[srno]'>";
                                                            echo "<input type='hidden'   class='subcode text-right form-control form' name='subcode_$ctr'     value='$row[accode]'></td>";
                                                            echo "<td><input type='text' class='form-control form trname'             name='trname_$ctr'      value='$name'></td>";
                                                            echo "<td><input type='text' class='form-control form trname2'             name='trname2_$ctr'      value='$name2'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form trgender select2'  name='trgender_$ctr' style='width:100%'>";
                                                            echo "<option value='$row[gender]'>$trgender</option>";
                                                            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='$row[dob]'></td>";
                                                            echo "<td><input type='text' class='form-control form trage'        name='trage_$ctr'       value='$row[age]'></td>";
                                                            echo "<td><input type='text' class='form-control form trbirthpl'            name='trbirthpl_$ctr'     value='$row[birthpl]'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form trrelation select2' 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 trstatus select2' name='trstatus_$ctr' style='width:100%'>";
                                                            echo "<option value='$row[mstatus]'>$trstatus</option>";
                                                            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='$row[aadhaar]'></td>";

                                                            echo "<td><input type='text' class='form-control form trmobile'    name='trmobile_$ctr'       value='$row[mobile]'>";
                                                            echo "<input type='hidden' class='form-control form tremail'       name='tremail_$ctr'        value='$row[email]'>";
                                                            echo "<input type='hidden' class='form-control form troccupation'  name='troccupation_$ctr'   value='$row[occupation]'></td>";

                                                            echo "<td><input type='text' class='form-control form trquali'            name='trquali_$ctr'     value='$row[qualification]'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form trprofess select2' 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 {
                                                        $pctr = 0;
                                                        ?>
                                                        <tr>
                                                            <td><i class='fa fa-close remove'></i></td>
                                                            <td><input type='text' name='srno_<?= $pctr ?>' class='srno form-control form' value='1'>
                                                                <input type='hidden' name='subcode_0' class='subcode form-control form' value='0'>
                                                            </td>
                                                            <td><input type='text' name='trname_0' class='trname form-control form' value=''></td>
                                                            <td><input type='text' name='trname2_0' class='trname2 form-control form' value=''></td>
                                                            <td>
                                                                <select name="trgender_0" class="form-control form select2 trgender" style="width:100%">
                                                                    <option value='M'>MALE</option>
                                                                    <option value='F'>FEMALE</option>
                                                                </select>
                                                            </td>
                                                            <td><input type='date' name='trdob_0' class='trdob form-control form' value=''></td>
                                                            <td><input type='text' name='trage_0' class='trage form-control form' value=''></td>
                                                            <td><input type='text' name='trbirthpl_0' class='trbirthpl form-control form' value=''></td>
                                                            <td>
                                                                <select name="trrelation_0" class="form-control form select2 trrelation" style="width:100%">
                                                                    <option></option>
                                                                    <?php
                                                                    $mown1 = mysqli_query($conn, "SELECT code,name FROM $zdb.relation") or die(mysqli_error($conn));
                                                                    while ($trow = mysqli_fetch_array($mown1)) {
                                                                        echo "<option value='$trow[name]'>$trow[name]</option>";
                                                                    }
                                                                    ?>
                                                                </select>
                                                            </td>
                                                            <td>
                                                                <select name="trstatus_0" class="form-control form select2 trstatus" style="width:100%">
                                                                    <option value='M'>MARRIED</option>
                                                                    <option value='S'>SINGLE</option>
                                                                    <option value='D'>DIVORCE</option>
                                                                    <option value='W'>WIDOW</option>
                                                                </select>
                                                            </td>
                                                            <td><input type='number' onKeyPress="if (this.value.length === 12)
                                                                                return false;" name='traadhaar_0' class='traadhaar form-control form' value=''></td>
                                                            <td><input type='text' name='trmobile_0' class='trmobile form-control form' value=''></td>
                                                            <td><input type='text' name='trquali_0' class='trquali form-control form' value=''></td>
                                                            <td>
                                                                <select name="trprofess_0" class="form-control form select2 trprofess" style="width:100%">
                                                                    <option></option>
                                                                    <?php
                                                                    $prof1 = mysqli_query($conn, "SELECT code,name FROM $zdb.profession") or die(mysqli_error($conn));
                                                                    while ($tpro = mysqli_fetch_array($prof1)) {
                                                                        echo "<option value='$tpro[name]'>$tpro[name]</option>";
                                                                    }
                                                                    ?>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                        <?php
                                                    }
                                                    $pctr++;
                                                    ?>
                                                <input type="hidden" id="items" name="items" value="<?php echo ($addflag != 1) ? $ctr : 1; ?>">

                                                </tbody>
                                            </table>
                                        </div>
                                        <div class="col-lg-12 pad" style="padding-left:20px">
                                            <button type="button" class="btn btn-primary btn-square form" id="addnew">
                                                <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                            </button>
                                        </div>
                                    <?php } ?>

                                </div>
                            </div>
                        </div>
                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 pad">
                            <div class="panel panel-default">
                                <div class="panel-body">
                                    <div class="col-lg-1"></div>
                                    <div class="col-lg-3">
                                        <table class="table-condensed">
                                            <tr>
                                                <td class=" buttonform tooltip-bottom" id="sspdf" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="pdf">
                                                    <a id='subpdf' class="btn btn-pad btn-square " style="color:#ffffff; font-size: 12px;background-color: #a8b87c;border-radius: 5px ;margin-bottom: -47px;padding: 5px" href="blankmempdf.php" target="_blank">
                                                        <!-- <i class="fa fa-file-pdf-o" style="color:white"></i> -->
                                                        <p class="" style="color:white">Blank Family Details Form</p>
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <!-- <div class="col-lg-1">
                                        <table class="table-condensed" >
                                            <tr>
                                                <td class=" buttonform tooltip-bottom" id="sspdf"  data-toggle="tooltip" data-placement="bottom" title="" data-original-title="pdf">
                                                    <a id='subpdf' class="btn btn-pad btn-square " style="color:#ffffff; font-size: 15px;background-color: #a8b87c;border-radius: 5px;margin-bottom: -47px;" href="<?= $pdffile ?>?accode=<?= $qvouch; ?>&mvouch=<?= $mvouch ?>" target="_blank">
                                                        <p class="" style="color:white">PDF</p>
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                    </div> -->
                                    <div class="col-lg-1">
                                        <?php
                                        include("includes/buttons_mem.php");
                                        ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                </form>

                <div class="modal fade bs-example-modal-lg searchModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
                    <div class="modal-dialog modal-lg">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button class="close" data-dismiss="modal"><span>&times;</span></button>
                                <h4 class="modal-title" id="myLargeModalLabel">Search <? echo $formname; ?></h4>
                            </div>
                            <div class="modal-body">
                                <div class="row">
                                    <div class="col-lg-2">
                                        <select class="form-control sfield">
                                            <option value="1">Name</option>
                                            <option value="2">Area</option>
                                            <option value="3">Member No.</option>
                                            <option value="4">Family ID</option>
                                            <option value="5">Surname</option>
                                            <option value="6">Aadhaar</option>
                                            <option value="7">Mobile</option>
                                            <option value="8">Address</option>
                                        </select>
                                    </div>
                                    <div class="col-lg-2">
                                        <select class="form-control soperator">
                                            <option value="">Type of Search</option>
                                            <option value="%">Like</option>
                                            <option value="=">Exactly</option>
                                        </select>
                                    </div>
                                    <div class="col-lg-2">
                                        <select class="form-control sortBy">
                                            <option value="">Sort By</option>
                                            <option value="1">Name</option>
                                            <option value="2">Area</option>
                                            <option value="3">Member No.</option>
                                            <option value="4">Family ID</option>
                                            <option value="5">Surname</option>
                                            <option value="6">Aadhaar</option>
                                            <option value="7">Mobile</option>
                                            <option value="8">Address</option>
                                        </select>
                                    </div>
                                    <div class="col-lg-2">
                                        <select class="form-control orderAs">
                                            <option value="desc">Desc</option>
                                            <option value="asc">Asc</option>
                                        </select>
                                    </div>
                                    <div class="col-lg-2">
                                        <input type="text" value="" class="form-control ssearch" placeholder="Search Here">
                                    </div>
                                    <div class="col-lg-2">
                                        <input type="button" style="border-radius: 5px" class="btn btn-primary sload" value="Search">
                                    </div>
                                </div>
                                <div class="col-lg-12 sloader text-center">
                                    <!--<img src="images/search.gif" alt="loading">-->
                                </div>
                                <div class="col-lg-12 snoRecord text-center">
                                    <h3>NO RECORDS FOUND</h3>
                                </div>
                                <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                                    <table id="" class="table table-striped table-condensed table-bordered" width="100%">
                                        <thead>
                                            <tr class="mySearchTr">
                                                <th width="2%">Member No.</th>
                                                <th width="2%">Family ID</th>
                                                <th width="26%">Name</th>
                                                <th width="20%">Area</th>
                                                <th width="10%">Surname</th>
                                                <th width="18%">Aadhaar</th>
                                                <th width="5%">Mobile</th>
                                                <th width="10%">Address</th>
                                                <th width="2%">Action</th>

                                            </tr>
                                        </thead>
                                        <tbody class="sTbody">
                                        </tbody>
                                    </table>
                                </div>
                                <div class="row">
                                    <div class="col-xs-12 text-right search-action-bar">
                                        <input type="button" class="btn btn-primary sprev" style="border-radius: 5px" value="Previous">
                                        <input type="button" class="btn btn-primary snext" style="border-radius: 5px" value="Next">
                                    </div>
                                </div>

                            </div>
                            <div class="modal-footer"></div>
                        </div>
                    </div>
                </div>
                <?php include("includes/linksfoot.php"); ?>
                </body>

                </html>