I have a form that users input info and upon submission, an email should be sent and I would also like to redirect to another page which at the moment I am using the form 'action' to do but that is not the main issue. I would like to know why it's not sending for now yet no error shows.
<?php
include "inc/header.php";
$error ="";
if (isset($_POST['moving']) && !empty($_POST['moving'])){
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])){
//your site secret key
$secret = '6Lf';
//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)
{
$tsize = $_POST['size'];
$name = $_POST['omname'];
$email = $_POST['ommail'];
$phone = $_POST['omphone'];
$message = $_POST['ommessage'];
$messagetwo = $_POST['tommessage'];
$to = 'test@gmail.com';
$subject = 'Moving';
$main = '
<html>
<head>
<title> Moving</title>
</head>
<body>
<h3>Submission from Website - Moving form</h3>
<table cellspacing="0" cellpadding="10" style="width: 400px; height: auto;">
<tr>
<th style="width: 200px; vertical-align: top; text-align: left"> Size:</th><td> '.$tutasize.'</td>
</tr>
<tr>
<th style="width: 200px; vertical-align: top; text-align: left">Name:</th><td> '.$name.'</td>
</tr>
<tr style="width: 200px vertical-align: top; text-align: left; background-color: #e0e0e0;">
<th style="width: 200px; vertical-align: top; text-align: left">Email:</th><td> '.$email.'</td>
</tr>
<tr style="width: 200px vertical-align: top; text-align: left; background-color: #e0e0e0;">
<th style="width: 200px; vertical-align: top; text-align: left">Phone:</th><td> '.$phone.'</td>
</tr>
<tr style="width: 200px vertical-align: top; text-align: left; background-color: #e0e0e0;">
<th style="width: 200px; vertical-align: top; text-align: left">Where From:</th><td> '.$message.'</td>
</tr>
<tr style="width: 200px vertical-align: top; text-align: left; background-color: #e0e0e0;">
<th style="width: 200px; vertical-align: top; text-align: left">Where to:</th><td> '.$messagetwo.'</td>
</tr>
</table>
</body>
</html>';
$headers .= "MIME-Version: 1.0" . "\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\n";
$headers .= 'From: Moving' . "\n" .
'Reply-To: test@gmail.com' . "\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $main, $headers);
echo '<h5 class="feedback-msg" id="hideMe"> Hello <span style="color:#f56464;">'.$name.'</span>, Your order has been received.</h5>';
}
}
}
?>
Here's my HTML form
<form action="actin.php" method="POST" id="moving">
<div class="paymentWrap">
<div class="btn-group paymentBtnGroup btn-group-justified" data-toggle="buttons">
<label class="btn tsize active">
<div class="method tus"> <span> S </span></div>
<input type="radio" value="S" class="sradio" name="tsize" checked required="">
</label>
<label class="btn tsize">
<div class="method tum"> <span> M </span></div>
<input type="radio" value="M" class="mradio" name="tsize" required="">
</label>
<label class="btn tsize">
<div class="method tul"> <span> L </span></div>
<input type="radio" value="L" class="lradio" name="tsize" required="">
</label>
</div>
</div>
<div class="form-group pdt2">
<input type="text" class="form-control" name="omname" id="exampleFormControlInput1" placeholder="Name" required="">
</div>
<div class="form-group">
<div class="row pdt1">
<div class="col-md-6"><input type="email" name="ommail" class="form-control" id="exampleFormControlInput1" placeholder="Email address" required=""></div>
<div class="col-md-6 smpt"><input type="phone" name="omphone" class="form-control" id="exampleFormControlInput1" placeholder="Phone number" required=""></div>
</div>
</div>
<div class="form-group pdt1">
<textarea class="form-control" id="exampleFormControlTextarea1" name="ommessage" placeholder="Where from" rows="3" required=""></textarea>
</div>
<div class="form-group pdt1">
<textarea class="form-control" id="exampleFormControlTextarea2" name="tommessage" placeholder="Where to" rows="3" required=""></textarea>
</div>
<div class="form-group">
<div class="g-recaptcha" data-sitekey="6Lf"></div>
</div>
<div class="form-group pdt1">
<input type="submit" class="form-submit btn" name="moving" value="Submit" form="moving" placeholder="Submit">
</div>
</form>
Kindly help troubleshoot, I get no error yet no mail is received