I have an html form where users will submit their contact information for us to get in contact with them. I would like to have all of this live on index.html
, but I am not opposed to having to create another file in the folder.
<form class="row" method="post" action="contact.php">
<div class="col-md-12">
<div class="form-group">
<input type="text" class="form-control" placeholder="Your Full Name">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Phone Number*">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Email Address*">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Company Name*">
</div>
<div class="form-group">
<textarea class="form-control lg_textarea" placeholder="Questions / comments"></textarea>
</div>
</div>
<div class="buttn_outer">
<button type="submit" class="btn signin_btn col-sm-5 clearfix" style="margin:0 0 0 4%; float: left;">Submit</button>
</div>
</form>
I have had php installed on the server machine. Looking at other examples I have found attempted using a php script as follows.
<?php
if($_POST["submit"]) {
$recipient = "me@me.com";
$subject = "Some Message subject";
$sender = $_POST["sender"];
$senderEmail = $_POST["senderEmail"];
$message = $_POST["message"];
$mailBody = "Name: ".$sender."\nEmail: ".$senderEmail."\n\n".$message;
mail($recipient, $subject, $mailBody, "From: ".$sender." <".$senderemail.">");
$thankYou = "<p>Thank you! Your message has been sent.</p>";
}
?>
As of right now it goes to the success message however I never get anything to go to my email. I am extremely new to php, any help/advice is appreciated.