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

$formname = "Member Register";
$action = "memreg_fr.php";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];

$zyear = right($zdb, 4);
//$mfrdate = getzdates($zyear, 'S');
//$mtodate = getzdates($zyear, 'E');

// $myyear = $_SESSION[$myyear];
$zroot = $_SESSION["zdbroot"];

mysqli_select_db($conn, $zroot);


//browse($zyear);
include("includes/linkshead.php");
?>
<!-- <script src="MyScript/monfromtodt.js" type="text/javascript"></script> -->
</head>

<body>
    <form method='POST' action="<?= $action; ?>">
        <!-- Default box -->
        <div>
            <div class="col-lg-7 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 class="actions pull-right">
                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Family ID</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="family" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getfam = mysqli_query($conn, "SELECT `familyid` FROM `member` WHERE `familyid` !='' group by familyid order by familyid") or die(mysqli_error($conn));
                                    while ($fetfam = mysqli_fetch_array($getfam)) {
                                        echo "<option value='$fetfam[familyid]'>$fetfam[familyid]</option>";
                                    }
                                    ?>
                                </select>
                            </div>

                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Member No.</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="memid" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getfam = mysqli_query($conn, "SELECT `accode` FROM `member` WHERE `accode` !='' group by accode order by accode") or die(mysqli_error($conn));
                                    while ($fetfam = mysqli_fetch_array($getfam)) {
                                        echo "<option value='$fetfam[accode]'>$fetfam[accode]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Member Name</label>
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="member" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $gten = mysqli_query($conn, "SELECT `accode`,`name` FROM `member` WHERE `accode` !='' ORDER BY accode") or die(mysqli_error($conn));
                                    while ($member = mysqli_fetch_array($gten)) {
                                        echo "<option value='$member[accode]'>$member[name]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Surname</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="surname" class="form-control select2">
                                    <option value=""></option>
                                    <?php

                                    $getsur = mysqli_query($conn, "SELECT `accode`,`surname` FROM `member` WHERE `accode` !='' GROUP BY surname ") or die(mysqli_error($conn));
                                    while ($fetsur = mysqli_fetch_array($getsur)) {
                                        echo "<option value='$fetsur[accode]'>$fetsur[surname]</option>";
                                    }
                                    ?>
                                </select>
                            </div>

                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Gender</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="gender" class="form-control select2">
                                    <option value=""></option>
                                    <option value='M'>MALE</option>
                                    <option value='F'>FEMALE</option>
                                </select>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">State</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="area" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getarea = mysqli_query($conn, "SELECT state FROM $zdb.`disttaluka` Group BY state") or die(mysqli_error($conn));
                                    while ($fetarea = mysqli_fetch_array($getarea)) {
                                        echo "<option value='$fetarea[state]'>$fetarea[state]</option>";
                                    }
                                    ?>
                                </select>
                            </div>

                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">District</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="district" id="district" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $gten1 = mysqli_query($conn, "SELECT district FROM $zdb.`disttaluka`  Group BY district") or die(mysqli_error($conn));
                                    while ($district = mysqli_fetch_array($gten1)) {
                                        echo "<option value='$district[district]'>$district[district]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Area</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="taluka" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $gettaluka = mysqli_query($conn, "SELECT taluka FROM $zdb.`disttaluka` Group BY taluka") or die(mysqli_error($conn));
                                    while ($fettaluka = mysqli_fetch_array($gettaluka)) {
                                        echo "<option value='$fettaluka[taluka]'>$fettaluka[taluka]</option>";
                                    }
                                    ?>
                                </select>
                            </div>

                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">City/Village</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="village" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getvillage = mysqli_query($conn, "SELECT village FROM `member` WHERE `village` !='' Group BY village") or die(mysqli_error($conn));
                                    while ($fetvillage = mysqli_fetch_array($getvillage)) {
                                        echo "<option value='$fetvillage[village]'>$fetvillage[village]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Pin</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="pin" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getpin = mysqli_query($conn, "SELECT pin FROM `member` WHERE `pin` !='' Group BY pin") or die(mysqli_error($conn));
                                    while ($fetpin = mysqli_fetch_array($getpin)) {
                                        echo "<option value='$fetpin[pin]'>$fetpin[pin]</option>";
                                    }
                                    ?>
                                </select>
                            </div>

                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Native</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="native" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getnative = mysqli_query($conn, "SELECT `native` FROM `member` WHERE `native` !='' GROUP BY `native`") or die(mysqli_error($conn));
                                    while ($fetnative = mysqli_fetch_array($getnative)) {
                                        echo "<option value='$fetnative[native]'>$fetnative[native]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Occupation</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="occupation" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getoccu = mysqli_query($conn, "SELECT `code`, `name` FROM $zdb.`occupation` WHERE `code` !='' order by `name`") or die(mysqli_error($conn));
                                    while ($fetoccu = mysqli_fetch_array($getoccu)) {
                                        echo "<option value='$fetoccu[name]'>$fetoccu[name]</option>";
                                    }
                                    ?>
                                </select>
                            </div>

                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Profession</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="profession" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getprof = mysqli_query($conn, "SELECT `code`, `name` FROM $zdb.`profession` WHERE `code` !='' order by `name`") or die(mysqli_error($conn));
                                    while ($fetprof = mysqli_fetch_array($getprof)) {
                                        echo "<option value='$fetprof[name]'>$fetprof[name]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Maritial Status</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="mstatus" class="form-control select2">
                                    <option value=""></option>
                                    <option value='M'>MARRIED</option>
                                    <option value='S'>SINGLE</option>
                                    <option value='D'>DIVORCE</option>
                                    <option value='W'>WIDOW</option>
                                </select>
                            </div>

                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">Qualification</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <select name="qualification" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $gten2 = mysqli_query($conn, "SELECT qualification FROM `member` WHERE `qualification` !='' GROUP BY qualification") or die(mysqli_error($conn));
                                    while ($qualification = mysqli_fetch_array($gten2)) {
                                        echo "<option value='$qualification[qualification]'>$qualification[qualification]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">From Age</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <input type="text" name="fage" class="form-control" value="" />
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control ">To Age</label>
                            </div>
                            <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 pad">
                                <input type="text" name="tage" class="form-control" value="" />
                            </div>
                        </div>

                        <div class="row pad">
                            <div class="col-lg-3 col-md-4 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control">Blood Group</label>
                            </div>
                            <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                                <select name="bloodgrp" class="form-control bloodgrp select2">
                                    <option value=""></option>
                                    <option value="A+">A+</option>
                                    <option value="O+">O+</option>
                                    <option value="B+">B+</option>
                                    <option value="AB+">AB+</option>
                                    <option value="A-">A-</option>
                                    <option value="O-">O-</option>
                                    <option value="B-">B-</option>
                                    <option value="AB-">AB-</option>
                                </select>
                            </div>

                            <div class="col-lg-2 col-md-4 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control">Physically Disabled</label>
                            </div>
                            <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                                <select name="phydis" class="form-control phydis select2">
                                    <option value="NO">NO</option>
                                    <option value="YES">YES</option>
                                </select>
                            </div>
                        </div>


                    </div>
                    <div class="panel-footer">
                        <div class="text-center pad">
                            <div class="panel-footer">
                                <?php include("includes/but_rep.php"); ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>

</html>