I'm trying to get a simple web form to work but I have almost no knowledge of psp, so bear with me. This is the php file
<?php
if(!isset($_POST['submit'])) {
$emailbody = 'name: '.$_POST['name']."\n"
.'email: '.$_POST['email']."\n"
.'message: '.$_POST['message']."\n";
mail('myemail@email.com', 'Subject line', $emailbody);
header('location: thankyou.html');
} else {
header('location: contact.html');
}
?>
And this is the form html:
<form method="post" action="test.php">
<!-- ===START FIELDS=== -->
<div class="fieldset">
<h2 class="contact-form">Contact Us</h2>
<div class="fields">
<p class="row">
<label>Name:</label>
<input type="text" id="first-name" name="name" class="field-large" required="required" aria-required="true" /></p>
<p class="row"><label>Email<span class="required">*</span>:</label><input type="email" id="email" name="email" placeholder="yourname@example.com" class="field-large" /></p>
<p class="row"><label>Message:</label><textarea id="message" id="message" name="message" cols="40" rows="5" class="field-large"/></textarea></p>
<input type="submit" value="submit" name="send" class="btn" />
</div>
</div>
</form>
On clicking 'submit'I get redirected to the 'thank you' page, but no email is received on my end. I'm testing this on XAMPP in case it matters. I've checked similar questions where it was suggeted to add ! before isset but this didn't help.