I'm creating a php form in my html contact page. The google re-captcha is working but my info is not getting submitted. I don't know what the problem could be. Here's my code. First is my html code.
contact.html
I've reduced the code for sake of brevity
This was placed in at the bottom of my head tag.
I'm using Go Daddy hosted and stackoverflow suggested to remove https from the URL
<form action="form.php" method="POST" role="form">
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="Your name">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Your email">
</div>
<div class="form-group">
<input type="phone" name="phone" class="form-control" placeholder="Your phone number (Optional)">
</div>
<div class="g-recaptcha" data-sitekey="My Site Key"></div>
<input type="submit" value="Submit" class="btn btn-success contact-button">
</form>
Here's my php script
<?php
if(isset($_POST['submit']) && !empty($_POST['submit'])):
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])):
//key
$secret = 'My Secret Key';
//get verify response data
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
$responseData = json_decode($verifyResponse);
if($responseData->success):
//Section above is for working with the recaptcha
//contact form submission code
$name = !empty($_POST['name'])?$_POST['name']:'';
$email =!empty($_POST['email'])?$_POST['email']:'';
$phone =!empty($_POST['phone'])?$_POST['phone']:'';
$occupation =!empty($_POST['occupation'])?$_POST['occupation']:'';
$option =!empty($_POST['option_group'])?$_POST['option_group']:'';
$message =!empty($_POST['message'])?$_POST['message']:'';
$recipient = "ryanbent01@gmail.com";
$subject = "Potential Digital Delivery Customer";
$formcontent=" From: $name \n Phone: $phone \n Occupation: $occupation \n Option: $option \n Message: $message";
$mailheader = "From: $email \r\n";
//send email
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
$succMsg = 'Your contact request have submitted successfully.';
else:
$errMsg = 'Robot verification failed, please try again.';
endif;
else:
$errMsg = 'Please click on the reCAPTCHA box.';
endif;
else:
$errMsg = '';
$succMsg = '';
endif;
?>
I'm not even getting the error messages showing up.