Seems lots of contact form problems lately here. Unfortunately I can’t seem to figure this one out. Seems simple enough.
I have a very long form. In order to keep things to the point, I’ll only post the code for the first few:
<?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: $name
Company: $company
Address: $address
Contact: $contact
Telephone: $telephone";
mail($to, $subject, $body);
} else {
echo "Oops.";
?>
Now, it’s only sending the first three fields: Name, Company and Address. Contact and Telephone are included, but the are blank. Looks like this:
Name: (name)
Company: (company)
Address: (address)
Contact:
Telephone:
Why only the first three items?
probably cause your html is wrong …
how is it echoing the name if you have $name set to the post but you’re using $your_name in the echo?
[quote=simplistik;2326849]probably cause your html is wrong …
how is it echoing the name if you have $name set to the post but you’re using $your_name in the echo?[/quote]
That would be because I am a giant idiot and forgot to change it in the post. It’s working fine in the actual PHP. I’ll edit my original post. And post up my html in a couple of minutes.
<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>
Syous
May 15, 2008, 9:25pm
5
add id=“telephone” etc, maybe?
Nah, $_POST is based off the name attribute. The only thing I can think is that you submitted it with out those two fields populated :lol:
lol
Nope. I’m retarded, but I’m not THAT retarded.
This is weirdness.