<?php
include "header.php";
$todo= mysqli_real_escape_string($con,$_GET["id"]);
?>
        <!-- ***** Breadcrumb Area Start ***** -->
        <section class="section breadcrumb-area d-flex align-items-center" style="background-image: linear-gradient(to right, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0)), url('dashboard/uploads/blog/buro.jpg'); background-size: cover; height: 100vh;">
            <div class="container">
                <div class="row">
                    <div class="col-12">
                        <!-- Breamcrumb Content -->
                        <div class="breadcrumb-content ">
                            <h1 class="text-white mb-3" style="font-size:38px;">
								Refer a<span class="text-primary" style="font-style: italic; font-family: cursive; background-color:black;"> friend</span>
							</h1>
							<h3 class="text-white" style="line-spacing:1.5vh;">Do you know someone in need of assistance? Recommend them to us, <br> and as a token of gratitude, we'll provide shopping vouchers for you to enjoy.</h3>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- ***** Breadcrumb Area End ***** -->


        <?php
    $rt=mysqli_query($con,"SELECT * FROM service where id='$todo'");
    $tr = mysqli_fetch_array($rt);
    $service_title = "$tr[service_title]";
    $service_detail = "$tr[service_detail]";
    $upadated_at = "$tr[upadated_at]";
    $ufile = "$tr[ufile]";
?>


        <!-- ***** About Area Start ***** -->
        <section id="contactus" class="section cta-area bg-overlay ptb_100">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-12 col-lg-10">
                        <!-- Section Heading -->
                        <div class="section-heading m-0">
							<div class="text-center"><h2 class="text-white">Refer and Get Rewards
</h2></div>
                            <p class=" text-white text-start d-none d-sm-block mt-4" style="text-align:justify; font-size:20px;">Amazon vouchers worth £75 will be provided to you for each friend you refer, once they have been paid through Ombrella for four weeks.
</p>                            
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- ***** About Area End ***** -->


        <!-- ***** Our Goal Area End ***** -->

        <!-- ***** Team Area Start ***** -->

        <!-- ***** Team Area End ***** -->

        <!--====== Contact Area Start ======-->
        <section id="contact" class="contact-area ptb_100">
            <div class="container">
                <div class="row justify-content-between align-items-center">
                    <div class="col-8 col-lg-12 pt-4 pt-lg-0">
                        <!-- Contact Box -->
                        <div class="contact-box ">
                            <!-- Contact Form -->
                            <?php
$status = "OK"; //initial status
$msg = "";

if (isset($_POST['save'])) {
    $firstName = mysqli_real_escape_string($con, $_POST['firstName']);
    $lastName = mysqli_real_escape_string($con, $_POST['lastName']);
    $email = mysqli_real_escape_string($con, $_POST['email']);
    $friendFirstName = mysqli_real_escape_string($con, $_POST['friendFirstName']);
    $friendLastName = mysqli_real_escape_string($con, $_POST['friendLastName']);
    $friendEmail = mysqli_real_escape_string($con, $_POST['friendEmail']);
    $friendPhone = mysqli_real_escape_string($con, $_POST['friendPhone']);

   if (strlen($firstName) < 1 || strlen($lastName) < 1) {
		$msg .= "Name Must Contain at Least 1 Character.<br>";
		$status = "NOTOK";
	}
	if (strlen($email) < 1) {
		$msg .= "Email Must Contain at Least 1 Character.<br>";
		$status = "NOTOK";
	}
	


    if ($status == "OK") {
        $recipient = "admin@ombrellacompany.com";
        $formcontent = "Your Name: $firstName $lastName \n Your Email: $email  \n Friend's Name: $friendFirstName $friendLastName \n Friend's Email: $friendEmail \n Friend's Phone: $friendPhone";
        $subject = "New Refer a Friend for Ombrella Website";
        $mailheader = "From: noreply@Ombrella.com \r\n";
        $result = mail($recipient, $subject, $formcontent);

        if ($result) {
            $errormsg = "
                <div class='alert alert-success alert-dismissible alert-outline fade show'>
                   Enquiry Sent Successfully. We shall get back to you ASAP.
                   <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
                </div>";
        }
    } elseif ($status !== "OK") {
        $errormsg = "
            <div class='alert alert-danger alert-dismissible alert-outline fade show'>
               " . $msg . " 
               <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button> 
            </div>";
    } else {
        $errormsg = "
            <div class='alert alert-danger alert-dismissible alert-outline fade show'>
               Some Technical Glitch Is There. Please Try Again Later Or Ask Admin For Help.
               <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
            </div>";
    }
}
?>

<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
						{
						print $errormsg;
						}
   ?>

<form action="" method="post" enctype="multipart/form-data">
                                <div class="row">
                                    <div class="col-12">
										<label for="firstName">Your Name <span class="" style="color:red; font-size:12px;">(Required)</span></label><br><br>
                                        <div class="row form-group">
                                            <div class="col">
												<label for="firstName">First</label>
												<input type="text" id="firstName" name="firstName" class="form-control" placeholder="Enter your first name" required>
											</div>
											<div class="col">
												<label for="lastName">Last</label>
												<input type="text" id="lastName" name="lastName" class="form-control" placeholder="Enter your last name" required>
											</div>
                                        </div>
										<br>
                                        <div class="form-group">
											<label for="email">Your Email Address <span class="" style="color:red; font-size:12px;">(Required)</span> </label>
                                            <input type="email" class="form-control" name="email" placeholder="Email" required="required">
                                        </div>
										<br>
										<label for="firstName">Your Friend's Name <span class="" style="color:red; font-size:12px;">(Required)</span></label><br><br>
                                        <div class="row form-group">
                                            <div class="col">
												<label for="friendFirstName">First</label>
												<input type="text" id="friendFirstName" name="friendFirstName" class="form-control" placeholder="Enter your first name" required>
											</div>
											<div class="col">
												<label for="friendLastName">Last</label>
												<input type="text" id="friendLastName" name="friendLastName" class="form-control" placeholder="Enter your last name" required>
											</div>
                                        </div>
										<br>
										<div class="form-group">
											<label for="friendEmail">Your Friend's Email Address <span class="" style="color:red; font-size:12px;">(Required)</span></label>
                                            <input type="email" class="form-control" name="friendEmail" placeholder="Your Friend's Email Address" required="required">
                                        </div>
										<br>
                                        <div class="form-group">
											<label for="friendPhone">Your Friend's Contact Number</label>
                                            <input type="text" class="form-control" name="friendPhone" placeholder="Your Friend's Contact Number">
                                        </div>
                                    </div>
									<br>
                                    
                                    <div class="col-6">
                                        <button type="submit" class="btn btn-bordered active btn-block mt-3" name="save"><span class="text-white pr-3"><i class="fas fa-paper-plane"></i></span>Send Message</button>
                                    </div>
                                </div>
                            </form>
                            <p class="form-message"></p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--====== Contact Area End ======-->

        <!--====== Call To Action Area Start ======-->
        
        <!--====== Call To Action Area End ======-->
<?php include "footer.php"; ?>

<!--Start of Tawk.to Script-->
<script type="text/javascript">
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/65d88e829131ed19d970b813/1hnaupcfg';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
<!--End of Tawk.to Script-->
