<?php include('include/head.php'); ?>

<body>
  
    <?php include('include/header.php'); ?>

<?php
$slug = $_GET['slug'];

$det = mysqli_query($conn, "SELECT * FROM `tbl_service` where slug='$slug'");
while($row = mysqli_fetch_array($det))
{
    $title = $row['title'];
    $content = $row['content'];
    $description = $row['description'];
    $photo = $row['photo'];
}
?>

    <!-- service detail Start -->
    <section class="all-service">
    <div class="container-xxl py-5">
        <div class="container">

            <!-- <h6 class="section-title bg-white text-start text-primary pe-3">PEN DRIVE CLASSES</h6>
            <h1 class="mb-4">Advantages of AKN CA Classes Pen Drive Classes </h1> -->

            <div class="row g-5">

                <div class="col-lg-6 mt-5  col-md-offset-1">
                    <div class="intro-thumb thumb"data-aos="zoom-in">
                        <img src="<?php path(); ?>/admin/assets/images/services-image/<?php echo $photo; ?>" alt="" width="100%">
                    </div><!-- /Intro Thumb End -->
                </div>

                <div class="col-lg-6 wow fadeInUp" data-wow-delay="0.3s">
                        <h1><?php echo $title; ?></h1>
                    <p style="text-align:justify;"><?php echo $content; ?>
                    </p>

                    <a class="btn btn-primary py-3 px-5 mt-2" href="" data-bs-toggle="modal"
                        data-bs-target="#exampleModal">Enquiry Now</a>
                </div>
                <div class="col-lg-12 wow fadeInUp" data-wow-delay="0.3s">
                     <p style="text-align:justify;"><?php echo $description; ?>
                    </p>
                </div>
            </div>
        </div>
    </div>
    </section>
    <!-- About End -->



<?php include_once('include/footer.php'); ?>
    

    <!-- modal start -->

    <!-- <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@mdo">Open modal for @mdo</button> -->

    <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <!-- <h5 class="modal-title" id="exampleModalLabel">Contact For Any Query</h5> -->
                    <h5>Contact For Any Query</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">

                    <form method="POST">
                        <div class="mb-3">
                            <label for="fname">Name:</label>
                            <input type="text" name="query-name" class="form-control" id="recipient-name">
                        </div>

                        <div class="mb-3">
                            <label for="email">Email:</label>
                            <input type="email" name="query-email" class="form-control" id="recipient-name">
                        </div>

                        <div class="mb-3">
                            <label for="email">Phone No:</label>
                            <input type="text" name="query-phone" class="form-control phone" id="number" placeholder="" maxlength="10">
                        </div>

                        <div class="mb-3">
                            <label for="message-text" class="col-form-label">Message:</label>
                            <textarea class="form-control" name="query-message" id="message-text"></textarea>
                        </div>
                        
                        <div class="mb-3">
                            <button type="submit" name="query-send" class="btn btn-primary" style="background: #5b8c51;">Send message</button>
                        </div>
                    </form>

                </div>
                <div class="modal-footer">
                    <!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> -->
                    
                </div>
            </div>
        </div>
    </div>
    <!-- modal end -->
    
     <?php
            if(isset($_POST['query-send']))
            {
$contact_name=$_POST['query-name'];
$contact_phone=$_POST['query-phone'];
$contact_email=$_POST['query-email'];
$location=$_POST['query-message'];
   
$to = "info@kwikrecycle.com";
$subject = "Website Enquiry Data";

$output ="
<html>
<head>
<title>Send Messages</title>
</head>
<body>
<p>Send Messages!</p>
<table border='1'>
<tr>
<th>Name</th>
<th>Phone</th>
<th>Email</th>
<th>Message</th>
</tr>
<tr>
<td>$contact_name</td>
<td>$contact_phone</td>
<td>$contact_email</td>
<td>$location</td>
</tr>
</table>
</body>
</html>
";

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From:'. $contact_email .  "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";

$mail_send = mail($to,$subject,$output,$headers);   
if($mail_send){
  echo "<script>
window.location = 'https://kwikrecycle.com/thank-you';</script>";
}else{
    echo "Something Went Wrongs";
}
            }
?>  

</body>

</html>