EDIT: My Mail does get sent, but it does not send the FORM information, just the text I have placed. So this isn't an e-mail issue, its an issue of getting the Data attached to the email. I have not seen this question before.
I'm not the best at PHP but I've been following a few guides on the internet, just learning some PHP. I've created a form in HTML that I want emailed to me upon submission. This is the code I have.
I am receiving an e-mail but the form input is not getting sent to me. Could someone please assist me. I've tried validating my code and it all seems right, and I don't see any flaws in my logic. Any help would be strongly appreciated.
<?php
//Creating Variables with data obtained from FORM on Previous Page
$firstname = $_POST['FirstName'];
$lastname = $_POST['LastName'];
$date = $_POST['Date'];
$pick_up_time = $_POST['Time'];
$vehicle = $_POST['Fleet'];
$passenger = $_POST['Passengers'];
$l_bags = $_POST['LargeBags'];
$s_bags = $_POST['SmallBags'];
$phone_number = $_POST['PhoneNumber'];
$e_mail = $_POST['eMail'];
$comments = $_POST['Comments'];
//Testing to see if variable is getting created
if ($firstname == "Reiyyan") {
print ("Welcome back, friend!");
}
else {
print ("MISSING DATA");
}
$email_from = 'reiyyan@gmail.com';
$email_subject = "New Message Test";
$email_body = "You got mail, here are the details. \n $firstname \n $lastname \n $date \n $pick_up_time \n $vehicle \n $passenger \n $l_bags \n $s_bags \n $phone_number \n $e_mail \n $comments".;
$to = "reiyyan@gmail.com";
$headers = "From: $email_from \r\n";
//send mail
mail($to,$email_subject,$email_body,$headers);
//done
?>
Here is my HTML Form
<form id="RequestCar" method="post" action="emailForm.php" enctype="text/plain">
First Name: <input type="text" name="FirstName" placeholder="First Name" required/>
Last Name: <input type="text" name="LastName" placeholder="Last Name" required />
<br /><br />
Date: <input type="date" name="Date" placeholder="01/01/2017" required />
Pickup Time: <input type="time" name="Time" placeholder="12:00 PM" required />
<br /><br />
Vehicle:
<select name="Fleet">
<option value="No Preference">No Preference</option>
<option value="LuxurySedan">Luxury Sedan</option>
<option value="SUV">Sub Utility Vehicle (SUV)</option>
<option value="Minivan">Minivan</option>
<option value="Minivan">Stretch Limousine</option>
<option value="Minivan">SUV Limousine</option>
<option value="Minivan">Hummer Limousine</option>
</select>
<br /><br />
# of Passengers: <input type="number" name="Passengers" required min="1" />
# of Large Bags: <input type="number" name="LargeBags" />
# of Small Bags: <input type="number" name="SmallBags" />
<br /><br />
Phone Number: <input type="tel" name="PhoneNumber" required />
eMail: <input type="email" name="eMail" required />
<br /><br />
Additional Comments
<br /><br />
<textarea rows="6" cols="100" name="Comments" form="RequestCar" placeholder="Enter Text Here..."></textarea>
<br /><br />
<input type="submit" value="Submit">
</form>
Regardless of what I try, I keep getting "MISSING DATA". It seems like the Form isn't passing on the variables to the php page.
Edit: This is hosted on GoDaddy, LINUX Server.