I'm making a contact form for my website that uses php to send the inputted information to my email.
My issue is that the isset php function returns false. I'm not sure why this is.
Here is my php code (the outputted result is "not sent")
<?php
if (isset($_POST['submit'])){
$name = $_POST['name'];
$subject = $_POST['subject'];
$mailFrom = $_POST['mail'];
$message = $_POST['message'];
$mailTo = "btrorapps@gmail.com";
$headers = "From: " .$mailFrom;
$txt = "You have received an email from " .$name.".\n\n".$message;
if (mail($mailTo, $subject, $txt, $headers)){
echo "<h1>sent successfully</h1>";
} else {
echo "<h1>something went wrong</h1>";
}
} else {
echo "not sent";
}
?>
Here is my form code
<form action="contactform.php" method="post" enctype="text/plain">
<label for="name">Name</label>
<input type="text" name="name" placeholder="Full name.." maxlength="20" required>
<label for="mail">Email</label>
<input type="text" name="mail" placeholder="Your email.."
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z{2,}$" required>
<label for="subject">Subject</label>
<input type="text" name="subject" maxlength="25" placeholder="Subject..">
<label for="message">Message</label>
<input type="text" name="message" placeholder="Message.." style="height:170px"
maxlength="150" required>
<input type="submit" value="submit" name="submit">
</form>