I rename contactus.html to contactus.php
[php]<?php session_start(); ?>
<!doctype html>
Contact Us
<?= isset($_SESSION['error']) ? $_SESSION['error'] : 'Contact Us'; ?>
If you would like to contact me or give me feedback please use the form below. I check my emails very often and I will get back to you as soon as I can. I usually reply back to the email no later than 48 hours. If it does happen then it is becuase their is a high volume of emails coming in at the time, but you should recieve an email within 2 days after. If you would like a quicker response, please email me at [email protected].
<p class="info">
<label for="name">Name</label>
<input type="text" name="name" placeholder="Full Name"/>
</p>
<p class="info">
<label for="Email">Email</label>
<input type="text" name="email" placeholder="Email"/>
</p>
<p class="info">
<label for="Site">Website</label>
<input type="text" name="site" placeholder="Website"/>
</p>
<p class="info">
<label for="subject">Subject</label>
<input type="text" name="subject" placeholder="Subject"/>
</p>
<p class="message" id="box">
<textarea name="message" placeholder="Message" rows="15" cols="40" /></textarea>
</p>
<p class="submit">
<input type="submit" name="submit" value="Send"/>
</p>
</form>
Copyright ©2014 TopNotchWebCreations, All Rights Reserved
![]()
[/php]
and left mailer.php name the same:
[php]<?php
session_start();
$sendMessage = true;
if ( isset($_POST[‘submit’]) && $_POST[‘submit’] == ‘Send’)
{
$email = $_POST[‘email’];
$name = $_POST[‘name’];
$subject = $_POST[‘subject’];
$message = $_POST[‘message’];
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$sendMessage = false;
$_SESSION['error'] = 'Invalid Email, Please Re-Enter';
}
if ( empty($name) || empty($subject) || empty($message) ) {
$sendMessage = false;
$_SESSION['error'] = 'Fields Can\'t Be Blank, Please Re-Enter';
}
if ( $sendMessage ) {
$to= "[email protected]";
$subject= "Website Feedback.";
$headers= "Mime Version: 1.0". "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "From: $email\r\n"; // setup the from field for e-mail
$headers .= "Content-type: text/html\r\n"; // setup e-mail format
$success = mail($to, $subject, $message, $headers);
} else {
header('Location: contactus.php');
exit();
}
}[/php]
However, sending mail I have no idea if that works or not, but if it doesn’t I’m sure someone will help you.