<?php include 'header.php'; ?>

<section class="page-header">
    <div class="page-header__bg" style="background-image: url(assets/images/product/banner.jpg);"></div>
    <div class="container">
        <div class="row">
            <div class="col-xl-12">
                <div class="page-header__wrapper">
                    <?php
                    $page_flname = $_REQUEST['file_name'] ?? '';
                    if (!empty($page_flname)) {
                        $flname1 = str_replace(".php", "", $page_flname);
                        $flname = strtolower($flname1);

                        $query = "SELECT * FROM subcategory WHERE slug = '$flname'";
                        $executeQuery = $d->selectQueryInArray($query);

                        if ($executeQuery) {
                            $row = $executeQuery[0]; // Get the first result only
                    ?>
                            <div class="page-header__content">
                                <h2><?php echo $row['product']; ?></h2>
                                <div class="page-header__menu">
                                    <ul>
                                        <li><a href="index.php">Home</a></li>
                                        <li>Products</li>
                                    </ul>
                                </div>
                            </div>
                    <?php
                        } else {
                            echo "<p>No data found for the given file name.</p>";
                        }
                    } else {
                        echo "<p>File name parameter is missing.</p>";
                    }
                    ?>
                </div>
            </div>
        </div>
    </div>
</section>
<!-- End Page Header -->

<!-- Start About One -->
<section class="about-one about-one--two about-one--two--about">
    <div class="container">
        <?php
        if (!empty($page_flname)) {
            if ($executeQuery) {
                $row = $executeQuery[0]; // Get the first result only
        ?>
                <div class="row">
                    <!-- Start About One Img Box -->
                    <div class="col-xl-6">
                        <div class="about-one__img">
                            <div class="shape1 zoom-fade"><img src="assets/images/shapes/about-v1-shape1.png" alt="" /></div>
                            <div class="about-one__img1">
                                <img src="admin/uploads/<?php echo $row['image']; ?>" style="width:552px; height:517px;" alt="" />
                            </div>
                        </div>
                    </div>
                    <!-- End About One Img Box -->

                    <!-- Start About One Content -->
                    <div class="col-xl-6">
                        <div class="about-one__content">
                            <div class="sec-title">
                                <span class="sec-title__tagline">WELCOME TO KRISHNA CREATIONS</span>
                                <h2 style="font-size:35px;" class="sec-title__title"><?php echo $row['product']; ?> </h2>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-bordered">
                                    <?php echo $row['description']; ?>
                                </table>
                                <button type="button" class="thm-btn" data-bs-toggle="modal" data-bs-target="#exampleModal">
                                    Yes! I am interested
                                </button>
                            </div>
                        </div>
                    </div>
                    <!-- End About One Content -->
                </div>
        <?php
            } else {
                echo "<p>No data found for the given file name.</p>";
            }
        } else {
            echo "<p>File name parameter is missing.</p>";
        }
        ?>
    </div>
</section>

<?php include 'footer.php'; ?>
