<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');
$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn,$zdb);

$zroot = $_SESSION["zdir"];
include("includes/linkshead.php");
?>
<body>

    <form action="smsadd.php" method="post">
        <div class="row">

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><b><?php Echo "SMS"; ?></b></h3>
                    <!--<h3 class="pull-right" style="padding:0px"></h3>-->
                </div>
                <div class="panel-body">
                    <div class="col-lg-6">

                        
                        <div class="row">
                            <div class="col-lg-3 text-right">
                                <label class="label-control">Member</label>
                            </div>
                            <div class="col-lg-5">
                                <select name="member" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getstate = mysqli_query($conn,"SELECT accode,name FROM `finallist` ORDER BY `name` ") or die(mysqli_error($conn));
                                    while ($getstate2 = mysqli_fetch_assoc($getstate)) {
                                        echo "<option value=\"$getstate2[accode]\">$getstate2[name]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-lg-3 text-right">
                                <label class="label-control">Region</label>
                            </div>
                            <div class="col-lg-5">
                                <select name="region" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getstate4 = mysqli_query($conn,"SELECT accode,name,region FROM `finallist` group by `region` ORDER BY `region` ") or die(mysqli_error($conn));
                                    while ($getstate3 = mysqli_fetch_assoc($getstate4)) {
                                        echo "<option value=\"$getstate3[region]\">$getstate3[region]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-lg-3 text-right">
                                <label class="label-control">Pin</label>
                            </div>
                            <div class="col-lg-5">
                                <select name="pin" class="form-control select2">
                                    <option value=""></option>
                                    <?php
                                    $getpin = mysqli_query($conn,"SELECT accode,name,region,pin FROM `finallist` group by `pin` ORDER BY `pin` ") or die(mysqli_error($conn));
                                    while ($fetpin = mysqli_fetch_assoc($getpin)) {
                                        echo "<option value=\"$fetpin[region]\">$fetpin[pin]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-lg-3 text-right" >
                                <label class="label-control">Message</label>

                            </div>
                            <div class="col-lg-3 ">
                                <!--<p style="padding:4px; margin: 4px;">-->
                                    <textarea rows="9" cols="40" name="sms" id="sms" maxlength="160"></textarea>
                                <!--</p>-->

                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-lg-3">

                            </div>
                            <div class="col-lg-2">
                                <!--<p style="padding:4px; margin: 4px;">-->
                                    <input type="text" name="cnt" id="cnt" value="0" disabled="disabled" style="width: 50px; background:grey; color:white; font-weight: bold; " />

                                <!--</p>-->
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3">

                            </div>
                            <div class="col-lg-3">
                                <!--<p style="padding:4px; margin: 4px;">-->
                                <input type="submit" name="submit" value="Send" style="height: 40px;width:120px;border-radius: 5px"/>
                                <!--</p>-->
                            </div>
                        </div>
                        <div style="clear:both"></div>

                    </div>

                    <!--                    <div class="col-lg-2">
                                            <div style="float:right;">
                                                <p style="padding:4px; margin: 4px;">
                                                    <textarea rows="5" cols="50" name="sms" id="sms" maxlength="160"></textarea>
                                                </p>
                                                <p style="padding:4px; margin: 4px;">
                                                    <input type="text" name="cnt" id="cnt" value="0" disabled="disabled" style="width: 50px; background:#66FFCC; color:red; font-weight: bold; " />
                    
                                                </p>
                    
                                            </div>
                                            <div style="clear:both"></div>
                                        </div>-->
                </div>
            </div>


        </div>

    </form>
</body>

<script type="text/javascript">
    $(function () {
        $("#sms").keypress(function () {
            var sms = $(this).val().length;
            if (sms >= 160) {
                $(this).attr("maxlength", "160");
            }
            $("#cnt").val(sms);
        });

    });
</script>
<?php
include("includes/linksfoot.php");
?>