// This is html file
<form role="form" action="mail.php" method="post">
<div class="form-group">
<input type="text" class="form-control" id="name" name="name" placeholder="Name" required>
</div>
<div class="form-group">
<input type="text" class="form-control" id="email" name="email" placeholder="Email" required>
</div>
<div class="form-group">
<input type="text" class="form-control" id="mobile" name="mobile" placeholder="Contact No." required>
</div>
<div class="form-group">
<textarea name="comment" class="form-control" type="textarea" id="message" placeholder="Comment on services required" rows="7"></textarea>
</div>
<button type="submit" id="submit" name="submit" class="btn btn-primary">Submit Mail
</button>
</form>
// This is php file attached to above html file
// I didn't get the mail after the submission of this code.
<?php
if (isset($_POST['submit']))
{
$sender_name=stripslashes($_POST["name"]);
$sender_email=stripslashes($_POST["email"]);
$sender_mobile=stripslashes($_POST["mobile"]);
$sender_message=stripslashes($_POST["comment"]);
$subject = "Enquiry Form";
$body = " \n";
$body .= " Name : ".$sender_name."\n";
$body .= " Email : ".$sender_email."\n";
$body .= " Mobile : ".$sender_mobile."\n";
$body .= " Brief : ".$sender_message."\n";
$to = "shubham.tropicalcluster@gmail.com";
if(mail($to, $subject, $body, "From: $sender_email")) {
header('Location:thanks.html');
}
}
else {
echo "ERROR SHUBHAM";
}
?>
//can I get a code that works my all form means universal .php file to mail all the details in the html form