<?php 
include('root/config.php');
if(isset($_REQUEST['submit']))
{
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$mobile = $_REQUEST['mobile'];
$message = $_REQUEST['message'];

$add_qry = "INSERT INTO ".DB_PREFIX."inquiry SET 
				   status='unchecked',
				   name='".$name."',
                   email='".$email."',
                   mobile='".$mobile."',
                   message='".$message."'";
$ai_db->aiQuery($add_qry);


$message_final = '<html>
<table width="100%" border="2"><tr><td colspan="2">Contact From Website For Training</td></tr>';

$message_final .= '<tr><td>Name:</td><td>'.$name.'</td></tr>';
$message_final .= '<tr><td>Email:</td><td>'.$email.'</td></tr>';
$message_final .= '<tr><td>Mobile:</td><td>'.$mobile.'</td></tr>';
$message_final .= '<tr><td>Message</td><td>'.$message.'</td></tr>';
$message_final .= '</table></html>';




			$subject = "Contact Mail From Website";
			$mailbody = $message_final;
			
			$headers = "MIME-Version: 1.0\r\n"; 
			$headers .= "Content-type: text/html\r\n"; 
			$headers .= "From:".$email."";
            
			mail($row[0]->email, $subject, $mailbody, $headers);

?>

<script>
	alert('your mail is send successfully.We will contact you soon. ');
	window.location='<?php echo SITE_URL; ?>Contact-Us';
</script>
<?php 
exit;



}
$qry = "SELECT * FROM ".DB_PREFIX."contact_us WHERE id='1'";
$row = $ai_db->aiGetQueryObj($qry);
?>
<!DOCTYPE html>
<html>


<head>
	<meta charset="utf-8">
	<title><?php echo $ai_core->aiGetValue(DB_PREFIX."setting","description","id",'6');?></title>
	<meta name="keywords" content="<?php echo $ai_core->aiGetValue(DB_PREFIX."setting","description","id",'12');?>">
	<meta name="description" content="<?php echo $ai_core->aiGetValue(DB_PREFIX."setting","description","id",'18');?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="icon" href="img/favicon.jpg">
	<link href="https://fonts.googleapis.com/css?family=Playfair+Display:400,700,900" rel="stylesheet">
	<link rel="stylesheet" href="css/core.css">
	<link rel="stylesheet" href="css/theme.css">
</head>
<body class="sticky-header sticky-footer">

	<!-- Preloader -->
	<div id="preloader"></div>
	
	<!-- Header -->
	<header id="header">

		<!-- Logo -->
		<a href="<?php echo SITE_URL; ?>Home" class="logo">
			<img src="logo.png" class="logo-light" alt="">
			<img src="logo.png" class="logo-dark" alt="">
		</a>

		<!-- Mobile Menu Icon -->
		<a href="#" class="mob-menu">
			<span></span><span></span><span></span>
		</a>

		<!-- Navigation -->
		<?php
		include('menu.php');
		?>
		<!-- /Navigation -->

	</header>
	<!-- /Header -->

	<!-- Main Content -->
	<main id="main">
		
		<!-- Hero -->
		<section class="hero-fullscreen flex-center py-10" data-background="img/gallery/21.jpg" data-overlay="black; .8">	
			<div class="page-title-wrapper text-light">
				<h1 class="page-title ">Contact Us</h1>
				<p class="page-subtitle">Let's we talk about your requirements!</p>
			</div>
		</section>
		<!-- /Hero -->

		<!-- Scroll Down Line -->
		<a href="#" class="scroll-down"><span></span></a>

		<!-- Contact Section -->
		<section class="bg-lines py-13 px-7">
			<div class="container p-0">
				<div class="row no-gutters">

					<!-- Details Column -->
					<div class="col-md-6">

						<h5>CONTACT INFO.</h5>
						
						<div><b>E-Mail :</b><br><?php echo $row[0]->email; ?></div>
						<div><b>Address :</b><br><?php echo $row[0]->address_1; ?></div>
						<div><b>Warehouse ADDRESS :</b><br><?php echo $row[0]->address_2; ?></div>
						<div><b>Contact Person :</b><br><?php echo $row[0]->person_name; ?></div>
						<div><b>Contact Number :</b><br><?php echo $row[0]->mobile_1; ?></div>
						<div><b>Contact Number :</b><br><?php echo $row[0]->mobile_2; ?></div>

					</div>
					<!-- /Details Column -->

					<!-- Contact Form Column -->
					<div class="col-md-6">
						
						<!-- Form Message -->
						<div class="mail-form-message d-none mb-5"></div>

						<!-- Contact Form -->
						<form class="" action="" method="POST">
							<input name="name" id="name" type="text" placeholder="Name:" required  />
							<input name="email" id="email" type="email" placeholder="Email:" required />
							<input name="mobile" id="mobile" type="text" placeholder="Mobile Number:" required />
							<textarea name="message" id="message" placeholder="Message:" required rows="4"></textarea>
							<button type="submit" name="submit" id="submit" class="button style-5 uppercase">send</button>
						</form>
						<!-- Contact Form -->

					</div>
					<!-- /Contact Form Column -->

				</div>
			</div>
		</section>
		<!-- /Contact Section -->

		<!-- Google Map -->
		<!--<section>
			<div class="google-map" 
			     data-api-key="AIzaSyCtwWwyEUBEqnW0dXhl3tGlqOje5YwCtHA"
			     data-latitude="1.3587045"
			     data-longitude="103.8317"
			     data-zoom="13"
			     data-marker="img/map-marker.png"></div>
		</section>	-->
		<!-- /Google Map -->

	</main>
	<!-- /Main Content -->

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

	<!-- JS -->
	<script src="js/core.js"></script>
	<script src="js/theme.js"></script>
</body>

</html>