<?php 
session_start();
// On Form Submit
if(isset($_POST['_sub_check']) && ($_POST['_sub_check'] == '1')) { 

	$validation = false;

	if (isset($_POST['number'])) {
		//print $_SESSION['number'] . ' - ' . $_POST['number'];
  		if ($_SESSION['number'] == $_POST['number']) {
	    $validation = true;	
		$val5 = true;
	} else {
	    $validation = false;
		$val5 = false;
	} }
	
		$name = $_POST['name'];
		$surname = $_POST['surname'];
		$tel = $_POST['tel'];
		$email = $_POST['email'];
		$enquiry = $_POST['message'];
		
	
	if($val5 == true) {
	
		$to = "mtacrh@iway.na";
		$subject = "General Enquiry from the Marley Architects Website";
		$message = "Name: " . $name . "\n\n";
		$message.= "Surname: " . $surname . "\n\n";
		$message.= "Email: " . $email. "\n\n";
		$message.= "Message: " . $enquiry;
		$from = "http://www.mtarch-inc.com/";
		$headers = "From: " . $from;
		
		mail($to,$subject,$message,$headers);


		$sent = "Thank you for you Enquiry! We will get back to you as soon as possible!";
	
	} else { $failure = "Sending Failed! Please make sure all the fields are filled out correctly and try again."; }

}

$header['title'] = $title;
$header['metaD'] = $metaD;
echo $this->load->view('inc/header'); 

?>

<div class="container">
	<div class="row-fluid" style="height:50px"></div>
	<div class="row-fluid">
		<div class="span2">

				<?php echo $this->load->view('inc/main_nav'); ?>		
			
		</div>
		<div class="span1"></div>
		<div class="span9">
			<div class="row-fluid" id="inner-content-div" style="padding-right:20px;">			
	<form name="contact" method="post" action="<?php print base_url('/') ?>contact">
<ul style="list-style-type:none">
<?php if(isset($sent)) { ?><li style="font-weight:bold; color:#060;"><?php print $sent; ?></li><?php } ?>
<?php if(isset($failure)) { ?><li style="font-weight:bold; color:#f60;"><?php print $failure; ?></li><?php } ?>
<li><h4>WE WOULD LIKE TO HEAR FROM YOU</h4></li>
<li>Fill out the form and we will get back to you as soon as possible</li>
<li><input name="_sub_check" type="hidden" value="1" /></li>
<li><input name="name" type="text" id="name" style="width:460px;" placeholder="Name" /></li>
<li><input name="surname" type="text" id="surname" style="width:460px;" placeholder="Surname" /></li>
<li><input name="tel" type="text" id="tel" style="width:460px;" placeholder="Tel" /></li>
<li><input name="email" type="text" id="email" style="width:460px;" placeholder="Email" /></li>
<li><textarea name="message" cols="" rows="" style="width:460px;" placeholder="Message"></textarea></li>
<li><strong>Security Code: </strong></li>
<li><img src="<?php echo base_url('/');?>/graphics/security_image.php" alt="security image" title="security_image" align="left" />&nbsp;<input name="number" type="text" value="" size="5" style="width:160px;" /></li>
<li><button class="btn btn-default btn-default" type="submit">Submit</button></li>

</ul>
</form>
			</div>		
		</div>
		</div>
	<hr>
	<?php echo $this->load->view('inc/footer');?>


</div>

</body>
</html>



<script>
$('#myTab a').click(function (e) {
  e.preventDefault();
  $(this).tab('show');
})
</script>