So i have a website I've built for a friend. The trouble I'm having is getting php to send an email from the entries within the contact form. I have it hosted on a paid server.
Anyway, heres the contact form within index.html:
`<form class="form-horizontal" id="rsvpForm" role="form" method="post" action="rsvp.php">
<div class="row">
<div class="col-lg-6 col-lg-offset-3">
<div class="form-group">
<label for="guestName">Name(s)</label>
<input type="text" class="form-control" name="guest_name" id="guestName" placeholder="Name(s)">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-lg-offset-3">
<div class="form-group">
<label for="response">Response</label>
<textarea class="form-control" name="response" id="response" placeholder="Response"></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-lg-offset-3">
<div class="form-group">
<label for="diet">Please include any special dietary requirements</label>
<textarea class="form-control" name="diet" rows="5" id="diet"></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-lg-offset-6">
<input id="submit" name="submit" type="submit" value="R.S.V.P." class="btn tf-btn btn-default">
</div>
</div>
`
And the rsvp.php file that does not appear to do anything -
'<?php
if(isset($_POST["submit"])){
$guest_name = $_POST['guest_name'];
$response = $_POST['response'];
$diet = $_POST['diet'];
$to = 'example@xyz.com';
$subject = 'Wedding';
$message = $_POST["From : $guest_name\n Response : $response\n Special Dietary Requirements : $diet"];
if ($_POST) {
mail ($to, $subject, $message);
http_response_code(501);
}
} else {
// Generate 400 response because required query params are missing.
http_response_code(400);
}
?>'
Any idea as to why the php is not firing the email off when i click submit?
Thanks