<?php
//Made by tutswoods.weebly.com *Tutswood Productions*.
if (empty($_POST) === false) {
$errors = array();
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
if (empty($name) === true || empty($email) || empty($message) === true) {
$errors[] = 'The given Given Fields are Required!';
} else {
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false ) {
$errors[] = 'Please typein a valid Email-address';
}
if (empty($errors) === true) {
//You Need a Gmail Account to get the submitted Forms thus you need a server with php mail() configured.
//Use 000webhost.com for testing purposes to test it.
//you can download the PDF file to configure PHP mail() function from the product website.
mail('hide@address.com', 'Subject', $message, 'From: ' . $email);
header('Location: index.php?sent');
exit();
}
}
}
?>
<!DOCTYPE html>
<html>
<head><title>Contact Form.</title>
<style type="text/css">
body {
padding-top: 20px;
margin: 0;
font-family: proxima-nova, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 21px;
color: #333333;
background-color: #ffffff;
}
#subex {
padding-top: 190px;
}
#formbox {width:400px; margin:10px auto; padding:10px; overflow:hidden; border:1px solid #000; border-radius:10px; -moz-border-radius:10px; -webkit-border-radius:10px; background:#F9F9F9;}
#formbox h1 {margin-bottom:20px; font-size:40px; line-height:40px; font-family:'HelveticaNeue-Light', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight:normal;}
button {float:right; width:auto; margin-bottom:0; padding:3px 30px; cursor:pointer; font-size:16px; border:1px solid #999; border-bottom-width:2px; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; background:#EEE;}
button:active {border-bottom-width:1px; padding:4px 30px 3px; background:#E9E9E9;}
legend {
display: block;
width: 100%;
padding: 0;
margin-bottom: 31.5px;
font-size: 21px;
line-height: 42px;
color: #000000;
border: 0;
border-bottom: 1px solid #eee;
}
</style>
</head>
<body>
<center>
<div id="formbox">
<?php
if (isset($_GET['sent']) === true) {
echo '<p>Thanks for Contacting us! We will contact you back by your email!</p>';
} else {
if (empty($errors) === false) {
echo '<ul>';
foreach($errors as $error) {
echo '<li>', $error, '</li>';
}
echo '</ul>';
}
?>
<h1>Contact Me Below</h1>
<form action="" method="post">
<p>
<label for="name">Your Name:</label>
<input type="text" name="name" id="name" <?php if (isset($_POST['name']) === true) {echo 'value="', strip_tags($_POST['name']), '"';}?>>
</p>
<p>
<label for="email">Your Email:</label>
<input type="text" name="email" id="email" <?php if (isset($_POST['email']) === true) {echo 'value="', strip_tags($_POST['email']), '"';}?>>
</p>
<p>
<label for="email">Your Message:</label><br>
<textarea name="message" id="message" rows="4" cols="40"> <?php if (isset($_POST['message']) === true) { echo strip_tags($_POST['message']); } ?></textarea>
</p>
<button>Sumbit</button>
</form>
<?php
}
?>
</div>
<legend></legend>
<div id="subex">
<hr>
<h1>Your Title Here</h1>
<p>Your Paragraph Goes here</p>
</div>
</body>
</html>