I just got into web designing and this is the first attempt at an Email sheet. I'm not 100 percent as to what I'm doing wrong here but when I hit submit my information is not sent and the data does not disappear. Can someone help me out and possibly show me a suggestion.
I have already tried the Mailto: action and it won't even open Microsoft outlook. Is it possible that this is because it's in my repository (it has been deployed so that I can see it live as well) and not the clients actual domain.?
HTML
<form action="contact-form.php" method="POST">
<label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" placeholder="Your
name..">
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lastname" placeholder="Your last
name..">
<label for="email">Email</label>
<input type="text" id="email" name="email"
placeholder="contactme@email.com...">
<label for="message">Message</label>
<textarea id="message" name="message" placeholder="Write message
here..." style="height:200px"></textarea>
<input type="submit" value="Submit">
</form>
PHP
if (isset($_POST['submit'])) {
echo "error; you must complete this form"
}
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$message = $_POST['message'];
if(empty($fname)||empty($lname)||empty($email)||empty($message))
{
echo "Please fill in all applicable fields!";
exit;
}
$email_from = 'contact@10keybookkeeping.com';
$email_subject = "New Email from "$fname $lname;
$email_body = "Message from $fname $lname. \n \n".
"email address: $email \n".
"Message: $message".
$to = "contact@10keybookkeeping.com";
$headers = "From: $email_from \r \n";
mail($to,$email_subject,$email_body.$header)