I have a form on a site I'm working on and I'm running into a small problem. When data is submitted, the email is only returning the first three fields of the form, and everything else is blank. As far as I can tell, my code and html are all correct. I guess they're not, though, since it's not working. Hence me posting this. Code as follows:
PHP Code:
<?php
if(isset($_POST['submit'])) {
$to = "my@email.com";
$subject = "Test";
$name = $_POST['Name'];
$company = $_POST['Company'];
$address = $_POST['Address'];
$contact = $_POST['Contact'];
$telephone = $_POST['Telephone'];
$body =
"Name: $namen
Company: $companyn
Address: $addressn
Contact: $contactn
Telephone: $telephone";
mail($to, $subject, $body);
} else {
echo "Oops.";
?>
Code:
<form action="form.php" method="post">
<table>
<tr>
<th><label>Name</label></th>
<td><input type="text" name="Name" style="width:300px"/></td>
</tr>
<tr>
<th><label>Company</label></th>
<td><input type="text" name="Company" style="width:300px"/></td>
</tr>
<tr>
<th><label>Address</label></th>
<td><input type="text" name="Address" style="width:300px"/></td>
</tr>
<tr>
<th><label>Contact</label></th>
<td><input type="text" name="Contact" style="width:300px"/></td>
</tr>
<tr>
<th><label>Telephone</label></th>
<td><input type="text" name="Telephone" style="width:300px"/></td>
</tr>
</table>
</form>
Like I said, it's only returning the first three items. The email looks like this:
Now, it's only sending the first three fields: Name, Company and Address. Contact and Telephone are included, but are blank. Looks like this:
Name: (whichever name you input)
Company: (company)
Address: (address)
Contact:
Telephone:
Anyone have any ideas?