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

<body>
    <!-- Spinner Start -->
    <div id="spinner" class="show bg-white position-fixed translate-middle w-100 vh-100 top-50 start-50 d-flex align-items-center justify-content-center">
        <div class="spinner-border text-primary" style="width: 3rem; height: 3rem;" role="status">
            <span class="sr-only">Loading...</span>
        </div>
    </div>
    <!-- Spinner End -->


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


   <!-- Header Start -->
   <div class="container-fluid bg-primary page-header" style="background-image: url('img/banner/career.png'); ">
        <div class="container ">
            <div class="row justify-content-center">
                
            </div>
        </div>
    </div>
    <!-- Header End -->


    <!-- franchise section Start -->
    <div class="container wow fadeInUp" data-wow-delay="0.1s" style="margin-top: 70px;">

        <div class="row ">

            <div class="col-md-6">
                
                <img src="img/career-img.webp" style="width:100%">

            </div>



            <div class="col-md-6 bg-dark d-flex align-items-center">
                <div class="p-3 wow fadeInUp" data-wow-delay="0.2s">
                    <!-- <h5 class="section-title ff-secondary text-start text-primary fw-normal">Join the crew!</h5> -->
                    <h1 class="text-white mb-4">Come join our Team !</h1>
                    <form method="POST" enctype="multipart/form-data">
                        <div class="row g-3">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="name" style="color: white;">Your Name</label>
                                    <input type="text" class="form-control" name="name" id="name" placeholder="Your Name">
                                </div>
                            </div>


                             <div class="col-sm-6 mt-3">
                                <div class="form-group">
                                    <label for="number" style="color: white;">Your Phone Number</label>
                                    <input type="text" placeholder="Your Phone Number" name="phone" class="form-control phone">
                                </div>
                            </div>



                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="email" style="color: white;">Your Email</label>
                                    <input type="email" class="form-control" name="email_id" id="email" placeholder="Your Email">

                                </div>
                            </div>

                           

                            <!--<div class="col-sm-6 mt-3">-->
                            <!--    <div class="form-group">-->
                            <!--        <label for="number" style="color: white;">Select Designation</label>-->
                            <!--        <select class="form-control" id="time" name="time" required>-->
                            <!--            <option value="">Select Designation</option>-->
                            <!--            <option value="Jaap">LOrem Ipsum</option>-->
                            <!--            <option value="Katha">LOrem Ipsum</option>-->
                            <!--            <option value="Pooja">LOrem Ipsum</option>-->
                            <!--            <option value="Yagg">LOrem Ipsum</option>-->
                            <!--        </select>-->
                            <!--    </div>-->
                            <!--</div>-->


                            <div class="col-sm-12 mt-3">
                                <div class="form-group">
                                    <label for="resume" style="color: white;">Attach Resume</label>
                                    <input type="file" class="form-control" id="resume" name="file"
                                        accept=".pdf,.doc,.docx">

                                </div>
                            </div>

                            <div class="col-sm-12 mt-3">
                                <div class="form-group">
                                    <label for="resume" style="color: white;">Message</label>
                                    <textarea class="form-control" id="message" name="message" rows="3"
                                        placeholder="Message" required></textarea>
                                </div>
                            </div>



                            <div class="text-center">
                                <button class="btn btn-primary  py-3" type="submit" name="submit-career" style="width: 160px;">Submit</button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>

        </div>
    </div>
    <!-- franchise section end -->

<?php
if(isset($_POST['submit-career']))
{
     $filenameee =  $_FILES['file']['name'];
    $fileName = $_FILES['file']['tmp_name']; 
    $name = $_POST['name'];
    $email = $_POST['email_id'];
    $phone = $_POST['phone'];
    $usermessage = $_POST['message'];
    
    $message ="Name = ". $name . "\r\n  Email = " . $email . "\r\n Phone No =" . $phone . "\r\n Message =" . $usermessage; 
    
    $subject ="Contact Enquiry Form";
    $fromname ="Contact Form Enquiry";
    $fromemail = 'info@kwikrecycle.com';  //if u dont have an email create one on your cpanel

    $mailto = 'info@kwikrecycle.com';  //the email which u want to recv this email

    $content = file_get_contents($fileName);
    $content = chunk_split(base64_encode($content));

    // a random hash will be necessary to send mixed content
    $separator = md5(time());

    // carriage return type (RFC)
    $eol = "\r\n";

    // main header (multipart mandatory)
    $headers = "From: ".$fromname." <".$fromemail.">" . $eol;
    $headers .= "MIME-Version: 1.0" . $eol;
    $headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol;
    $headers .= "Content-Transfer-Encoding: 7bit" . $eol;
    $headers .= "This is a MIME encoded message." . $eol;

    // message
    $body = "--" . $separator . $eol;
    $body .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol;
    $body .= "Content-Transfer-Encoding: 8bit" . $eol;
    $body .= $message . $eol;

    // attachment
    $body .= "--" . $separator . $eol;
    $body .= "Content-Type: application/octet-stream; name=\"" . $filenameee . "\"" . $eol;
    $body .= "Content-Transfer-Encoding: base64" . $eol;
    $body .= "Content-Disposition: attachment" . $eol;
    $body .= $content . $eol;
    $body .= "--" . $separator . "--";

    //SEND Mail
    if (mail($mailto, $subject, $body, $headers)) {
         echo "mail send ... okk!";
        echo "<script>
       window.location = 'https://kwikrecycle.com/thank-you';</script>";
        
    } else {
        echo "mail send ... ERROR!";
        print_r( error_get_last() );
    }
}
?>
    

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

</body>

</php>