<?php

//include html header
require_once("includes/html-header.php");

//check for value
if (!isset($_GET['lid']) || !is_numeric($_GET['lid'])) {
    header('Location: log.php');
}else{
    $lid = $_GET['lid'];
    $sql = "SELECT * from log where id = (:id)";
    $query = $dbh->prepare($sql);
    $query->bindParam(':id', $lid, PDO::PARAM_STR);
    $query->execute();

    if($query->rowCount() == 0){
        header('Location: log.php');
    }

    $resultslog = $query->fetchAll(PDO::FETCH_OBJ);
    // echo "<pre>";
    // print_r($resultslog[0]->id);
    // echo "</pre>";
    // die();
}


error_reporting(1);

?>

<body>
    <!--  Body Wrapper -->
    <div class="page-wrapper" id="main-wrapper" data-layout="vertical" data-navbarbg="skin6" data-sidebartype="full" data-sidebar-position="fixed" data-header-position="fixed">


        <?php

        //include sidebar
        require_once("includes/sidebar.php");

        ?>

        <!--  Main wrapper -->
        <div class="body-wrapper">


            <?php

            //include header
            require_once("includes/header.php");

            ?>



            <div class="container-fluid">
                <!-- notice -->
                <marquee class="alert alert-dark text-white" onmouseover="this.stop()" onmouseout="this.start()" role="alert" style="font-size: 1rem;">
                    <?php $se = "SELECT * FROM notice";
                    $data = mysqli_query($link, $se);
                    $d = mysqli_fetch_assoc($data);
                    echo $d['notice']; ?>
                </marquee>
                <!-- notice end -->

                <form method="POST" action="nid-bn.php" target="_blank">
                    <div class="mb-3">
                        <label for="exampleInputPassword1" class="form-label">ছবি এবং সিগনাচার</label>
                        <br />

                        <div class="d-sm-block text-center d-md-flex d-lg-flex justify-content-between align-items-center">
                            <img style="max-width: 150px; max-height: 150px" class="img-thumbnail rounded" src="<?php echo $resultslog[0]->userImg ?>" alt="" />
                            <input type="hidden" value="<?php echo $resultslog[0]->userImg ?>" name="imageUrl12" />


                            <img style="max-width: 100%; max-height: 100px" class="img-thumbnail rounded" src="<?php echo $resultslog[0]->signatureImg ?>" name="imageUrl22" />
                            <input type="hidden" value="<?php echo $resultslog[0]->signatureImg ?>" name="imageUrl22" />

                        </div>
                    </div>

                    <div class="mb-3">
                        <label class="form-label">নামঃ (বাংলা)</label>
                        <input type="text" class="form-control" value="<?php echo $resultslog[0]->nameBangla; ?>" name="nameBangla" />
                    </div>

                    <div class="mb-3">
                        <label class="form-label">নামঃ (ইংরেজী)</label>
                        <input type="text" class="form-control" value="<?php echo $resultslog[0]->nameEnglish ?>" name="nameEnglish" />
                    </div>
                    <div class="mb-3">
                        <label class="form-label">আইডি নাম্বারঃ</label>
                        <input type="number" class="form-control" value="<?php echo $resultslog[0]->nid; ?>" name="nid" />
                    </div>

                    <div class="mb-3">
                        <label class="form-label">পিন নাম্বারঃ</label>
                        <input type="number" class="form-control" value="<?php echo $resultslog[0]->pin; ?>" name="pin" />
                    </div>
                    <div class="mb-3">
                        <label class="form-label">পিতার নামঃ</label>
                        <input type="text" class="form-control" value="<?php echo $resultslog[0]->fatherName; ?>" name="nameFather" />
                    </div>

                    <div class="mb-3">
                        <label class="form-label">মাতার নামঃ</label>
                        <input type="text" class="form-control" value="<?php echo $resultslog[0]->motherName; ?>" name="nameMother" />
                    </div>

                    <div class="mb-3">
                        <label class="form-label">জন্ম স্থানঃ</label>
                        <input type="text" class="form-control" value="<?php echo $resultslog[0]->birthPlace; ?>" name="birthPlace" />
                    </div>
                    <div class="mb-3">
                        <label class="form-label">জন্ম তারিখঃ</label>
                        <input type="text" class="form-control" value="<?php echo $resultslog[0]->dateOfBirth; ?>" name="dob" />
                    </div>
                    <div class="mb-3">
                        <label class="form-label">প্রধানের তারিখঃ</label>
                        <input type="text" class="form-control" value="<?php $newDate = date('d/m/Y');
                                                                        echo $newDate; ?>" name="issued" />
                    </div>
                    <div class="mb-3">
                        <label class="form-label">রক্তের গ্রপঃ</label>
                        <input type="text" class="form-control" value="<?php echo $resultslog[0]->bloodGroup; ?>" name="bloodGroup" />
                    </div>
                    <div class="mb-3">
                        <label class="form-label">ঠিকানাঃ</label>
                        <textarea name="fulladdress" id="" class="form-control" cols="30" rows="3"><?php echo $resultslog[0]->address; ?></textarea>
                    </div>

                    <input type="hidden" name="gender" value="<?php echo $resultslog[0]->gender; ?>">
                    <input type="hidden" name="maritalStatus" value="<?php echo $resultslog[0]->maritalStatus; ?>">
                    <input type="hidden" name="spouseName" value="<?php echo $resultslog[0]->spouseName; ?>">
                    <input type="hidden" name="religion" value="<?php echo $resultslog[0]->religion; ?>">
                        <div class="alert alert-info" role="alert">
                            আপনার একাউন্ট থেকে 
                            <?php 
                              $sql = "SELECT * FROM control WHERE id='1'";
                              if ($resulttt = mysqli_query($link, $sql)) {
                                  if (mysqli_num_rows($resulttt) > 0) {
                                      while ($row = mysqli_fetch_array($resulttt)) {
                                          echo $row['cost'];
                                      }
                                  }
                              }    
                            ?> 
                            টাকা কাটা হবে।
                        </div>
                    <button type="submit" class="btn btn-primary text-center d-block mx-auto">
                        ডাউনলোড করুন
                    </button>
                </form>





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

    <script src="assets/libs/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="assets/js/sidebarmenu.js"></script>
    <script src="assets/js/app.min.js"></script>
    <script src="assets/libs/simplebar/dist/simplebar.js"></script>



</body>

</html>