<?php

session_cache_limiter('nocache');

header('Expires: ' . gmdate('r', 0));

header('Content-type: application/json');

$to = 'you@domain.com';

$subject = $_POST['subject'];

if(isset($_POST['email'])) {

$name = $_POST['name'];

$email = $_POST['email'];

$fields = array(

0 =>array(

'text' => 'Name',

'val' => $_POST['name']

),

1 =>array(

'text' => 'Email address',

'val' => $_POST['email']

),

2 =>array(

'text' => 'Message',

'val' => $_POST['message']

)

);

$message = "";

foreach($fields as $field) {

$message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>\n";

}

$headers = '';

$headers .= 'From: ' . $name . ' <' . $email . '>' . "\r\n";

$headers .= "Reply-To: " .  $email . "\r\n";

$headers .= "MIME-Version: 1.0\r\n";

$headers .= "Content-Type: text/html; charset=UTF-8\r\n";

if (mail($to, $subject, $message, $headers)){

$arrResult = array ('response'=>'success');

} else{

$arrResult = array ('response'=>'error');

}

echojson_encode($arrResult);

} else {

$arrResult = array ('response'=>'error');

echojson_encode($arrResult);

}

?>
<html>
<head>
	<title> contact</title>
</head>
<body>



<div class="contact-wapper">
 <h2 class="title"><strong>Contact</strong> Us</h2>
 <form id="contactForm" action="php/contact-form.php" method="POST" >
 <div class="row">
 <div class="form-group">
 <div class="col-md-6">
 <label>Your name *</label>
 <input type="text" value="" maxlength="100" class="form-control" name="name" id="name" required="" aria-required="true">
 </div>
 <div class="col-md-6">
 <label>Your email address *</label>
 <input type="email" value="" maxlength="100" class="form-control" name="email" id="email" required="" aria-required="true">
 </div>
 </div>
 </div>
 <div class="row">
 <div class="form-group">
 <div class="col-md-12">
 <label>Subject</label>
 <input type="text" value="" maxlength="100" class="form-control" name="subject" id="subject" required="" aria-required="true">
 </div>
 </div>
 </div>
 <div class="row">
 <div class="form-group">
 <div class="col-md-12">
 <label>Message *</label>
 <textarea maxlength="5000" rows="10" class="form-control" name="message" id="message" required="" aria-required="true"></textarea>
 </div>
 </div>
 </div>
 <div class="row">
 <div class="col-md-12">
 <input type="submit" value="Send Message" class="btn btn-primary btn-lg mb-xlg" />
 </div>
 </div>
 </form>
</div>


</body>
<style>

*{box-sizing: border-box;}

.col-md-6 {

width: 50%;

float: left;

padding: 0 15px;

}

.col-md-12{width:100%;float:left;padding:0 15px}

label {

display: inline-block;

max-width: 100%;

margin-bottom: 8px;

font-weight: bold;

}

.form-control {

display: block;

width: 100%;

height: 34px;

padding: 6px 12px;

font-size: 14px;

line-height: 1.42857143;

color: #555;

background-color: #fff;

background-image: none;

border: 1px solid #ccc;

border-radius: 4px;

-webkit-box-shadow: inset 0 1px 1pxrgba(0, 0, 0, .075);

box-shadow: inset 0 1px 1pxrgba(0, 0, 0, .075);

-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;

-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;

transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;

}

.form-group {

width: 100%;

float: left;

padding: 15px 0;

}

.contact-wapper {

width: 40%;

margin: auto;

}

h2.title {

padding: 0 15px;

}

textarea#message {

height: auto;

}

input.btn.btn-primary.btn-lg.mb-xlg {

color: #fff;

background-color: #204d74;

border-color: #122b40;

height: 30px;

border: none;

}


</style>



</html>