I have tried looking at other related questions, and I have even asked some developer friends for help, but nothing has helped me fix my contact form. I have a basic PHP form, but on submit, I am missing the message textarea field in the email.
FORM CODE:
<form action="sendContactForm.php" method="post">
<div class="row">
<div class="small-12 large-12">
<div class="row formRow">
<div class="small-3 large-3 columns">
<label for="name" class="right inline">Name</label>
</div>
<div class="small-9 large-9 columns">
<input name="name" type="text" id="name" placeholder="Firstname Lastname">
</div>
</div>
</div>
</div>
<div class="row">
<div class="small-12 large-12">
<div class="row formRow">
<div class="small-3 large-3 columns">
<label for="email" class="right inline">Email</label>
</div>
<div class="small-9 large-9 columns">
<input name="email" type="text" id="email" placeholder="you@email.com">
</div>
</div>
</div>
</div>
<div class="row">
<div class="small-12 large-12">
<div class="row formRow">
<div class="small-3 large-3 columns">
<label for="company" class="right">Company Name</label>
</div>
<div class="small-9 large-9 columns">
<input name="company" type="text" id="company" placeholder="eg: Apple, Google, Microsoft">
</div>
</div>
</div>
</div>
<div class="row">
<div class="small-12 large-12">
<div class="row formRow">
<div class="small-3 large-3 columns">
<label for="description" class="right inline">Details</label>
</div>
<div class="small-9 large-9 columns">
<textarea name="description" id="description" placeholder="Please say a few words about why you are contacting me. If this is a project request, some good things to include are: project type, budget, deadline, and expected results."></textarea>
</div>
</div>
</div>
</div>
<div class="row">
<div class="small-12 large-12">
<div class="row formRow">
<div class="small-12 large-9 large-offset-3 columns">
<input type="submit" name="submit" value="Submit" class="button expand"/>
</div>
</div>
</div>
</div>
</form>
PHP CODE:
<?php
// from the form
$name = trim(strip_tags($_POST['name']));
$email = trim(strip_tags($_POST['email']));
$company = trim(strip_tags($_POST['company']));
$message = $_POST['message'];
$body = $name."
".$company."
".$message."
";
// set here
$subject = "Contact form submitted!";
$to = 'kempfjj@gmail.com';
$headers = "From: $email
";
$headers .= "Content-type: text/html
";
// send the email
mail($to, $subject, $body, $headers);
// redirect afterwords, if needed
header('Location: index.html');
?>
I would really appreciate any help that a professional could give me on this.
<textarea name="description" id="description"
while getting you are using different variable, change
$message = $_POST['message'];
into
$message = $_POST['description'];
You have $message = $_POST['message'];
in your PHP code, but there is no input element with name message
on the form, so it will be empty.
There is one with the name description
and you are not getting that out in PHP. So do you mean:
$message = $_POST['description'];
OR you could change the name='description'
to name='message'
on the input element on the form.