<style>
.form {
background-color:rgba(0,0,0,.4);
font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
font-style:italic;
font-size:18px;
color:white;
padding:8px;
margin:2px;
border:none;
box-shadow: inset 2px 2px 1px 1px rgba(0,0,0,0.2);
-moz-box-shadow: inset 2px 2px 1px 1px rgba(0,0,0,0.2);
-webkit-box-shadow: inset 2px 2px 1px 1px rgba(0,0,0,0.2);
}
</style>
<section class="box1" style="padding:20px; width:510px;">
<br />
<?php
if (isset($_POST['email'])) { //if "email" variable is filled out, send email
function clean_input($data) { //a function that cleans the data when sent to it, to make sure it is clean and safe/secure.
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$to = "you@your.com"; //Email information, your email needs to be set up on your hosting account.
$email = clean_input($_POST['email']); // sends value to the clean_input function to make the data safe and then puts it in the php variable.
$subject = clean_input($_POST['subject']); //...
$message = clean_input($_POST['message']); //...
mail($to, "$subject", $message, "From:" . $email); //send email
echo "<span style='color:light-green; font-size:130%; font-family:Tahoma, Geneva, sans-serif;'>Thanks for sending me your note.<br />
I will get back with you as soon as I can.</span>"; //Email response
}
else { //if "email" variable is not filled out, display the form
?>
<form method="post">
<input class="form" name="email" placeholder="your@email.com" required type="email" /> <input type="submit" value="Send Message" style=" float:right;" /><br />
<input class="form" name="subject" placeholder="subject..." required type="text" /><br />
<textarea class="form" name="message" placeholder="your message..." required rows="10" cols="40"></textarea><br />
</form>
<?php
}
?>
</section>