Thank you in advance for your help. I am creating a contact form for the first time, but running into an issue. I am using HTML5, which I am moderately familiar with, and PHP, which I know little about. I can't seem to test this locally, so I uploaded my files to the root of my domain through Hostinger. After completing the form and clicking the submit button, I get the success message defined in the PHP file. The problem is, no email is sent to my address. I'm guessing that the PHP was executed correctly since I'm seeing the success message, and there are no errors in Hostinger's logs. Obviously, I am doing something wrong though if I am not getting the email, but I am just not sure what. I did have a basic version of a form working previously, but with all my changes and edits, I broke something. Could someone please take a look at my code below and please advise as to what I am doing wrong? Thank you very much!
Here is my HTML:
<form action="mail.php" method="POST">
<p id="page_form_text">
<input type="text" name="name" size="30" maxlength="30" placeholder="Your Name">
<input type="text" name="phone" size="12" maxlength="12" placeholder="Phone #">
</p>
<p id="page_form_text">
<input type="text" name="email" size="50" maxlength="50" placeholder="Email">
</p>
<p id="page_form_text">
<input type="text" name="address" size="50" maxlength="50" placeholder="Street Address">
</p>
<p id="page_form_text">
<input type="text" name="city" size="25" maxlength="25" placeholder="City">
<input type="text" name="zip" size="5" maxlength="5" placeholder="Zip">
</p>
<p id="page_form_text">
<textarea rows="10" name="experience" cols="50" maxlength="500" placeholder="Any Relevant Experience?"></textarea>
</p>
<p id="page_form_text">
<textarea rows="10" name="info" cols="50" maxlength="500" placeholder="Tell Us About Yourself"></textarea>
</p>
<input type="submit" name='submit' value="submit" style="margin-bottom:20px">
</form>
And here's my PHP (my email is masked):
<?php
if(isset($_POST['submit'])){
$to = "s*********@gmail.com"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$experience = $_POST['experience'];
$information = $_POST['info'];
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message = $first_name . " " . $last_name . " wrote the following:" . "\n\n" . $_POST['message'];
$message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>