# Small contact form problem

**URL:** https://forum.kirupa.com/t/small-contact-form-problem/260454
**Category:** programming
**Created:** [May 15, 2008, 7:24pm UTC](https://forum.kirupa.com/t/small-contact-form-problem/260454 "2008-05-15T19:24:42Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Awesome\_O\_4000](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Awesome\_O\_4000](https://forum.kirupa.com/u/Awesome_O_4000)
#### Post date: [May 15, 2008, 7:24pm UTC](https://forum.kirupa.com/t/small-contact-form-problem/260454/1 "2008-05-15T19:24:42Z")

</div>

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

<?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?

---

<div class="post-metadata">

### Author: ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)
#### Post date: [May 15, 2008, 8:55pm UTC](https://forum.kirupa.com/t/small-contact-form-problem/260454/2 "2008-05-15T20:55:16Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Awesome\_O\_4000](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Awesome\_O\_4000](https://forum.kirupa.com/u/Awesome_O_4000)
#### Post date: [May 15, 2008, 8:57pm UTC](https://forum.kirupa.com/t/small-contact-form-problem/260454/3 "2008-05-15T20:57:14Z")

</div>

[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.

---

<div class="post-metadata">

### Author: ![Awesome\_O\_4000](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Awesome\_O\_4000](https://forum.kirupa.com/u/Awesome_O_4000)
#### Post date: [May 15, 2008, 9:07pm UTC](https://forum.kirupa.com/t/small-contact-form-problem/260454/4 "2008-05-15T21:07:50Z")

</div>

```php

<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>

```

---

<div class="post-metadata">

### Author: ![Syous](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Syous](https://forum.kirupa.com/u/Syous)
#### Post date: [May 15, 2008, 9:25pm UTC](https://forum.kirupa.com/t/small-contact-form-problem/260454/5 "2008-05-15T21:25:51Z")

</div>

add id=“telephone” etc, maybe?

---

<div class="post-metadata">

### Author: ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)
#### Post date: [May 15, 2008, 9:47pm UTC](https://forum.kirupa.com/t/small-contact-form-problem/260454/6 "2008-05-15T21:47:42Z")

</div>

> [@Syous;2326864](#):
>
> 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:

---

<div class="post-metadata">

### Author: ![Awesome\_O\_4000](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Awesome\_O\_4000](https://forum.kirupa.com/u/Awesome_O_4000)
#### Post date: [May 16, 2008, 2:26pm UTC](https://forum.kirupa.com/t/small-contact-form-problem/260454/7 "2008-05-16T14:26:42Z")

</div>

> [@simplistik;2326878](#):
>
> 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.
