# PHP Email Form - Not posting all feilds?

**URL:** https://forum.kirupa.com/t/php-email-form-not-posting-all-feilds/255777
**Category:** programming
**Created:** [March 26, 2008, 9:04pm UTC](https://forum.kirupa.com/t/php-email-form-not-posting-all-feilds/255777 "2008-03-26T21:04:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![drunkel](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@drunkel](https://forum.kirupa.com/u/drunkel)
#### Post date: [March 26, 2008, 9:04pm UTC](https://forum.kirupa.com/t/php-email-form-not-posting-all-feilds/255777/1 "2008-03-26T21:04:15Z")

</div>

Okay…

As you can tell I am not big on S/S Scripting. I have a simple hyperlink to popup window (annoying, but works with clients wishes), that is meant to collect Name, Email, and Address. Mail those to a coworker. Simple.

Problem is, it only grabs the contents of the Address text area, not the name and the email feilds. Here is the HTML/PHP. Any help would be great, I am stumped.

Thanks!

FORM CODE:

```auto
<div id="divTwo">

<span class="text">
Name:
<br>
Email:
<br>
Address:
</span>
</div>
<form action="email.php" method="post">
    <? if ($message != "") {
        print '<span class="errortext">'.
            $message."<span><br>
";
    } 
    ?>
        

<input name="name" class="texta" type="text" value=""><br>
    

    <input name="email" class="texta" value="" type="text"><br>
        
        <textarea class="texta" name="address" rows="5" cols="30" Value=""></textarea><br>
        
    <input name="process" value="1" type="hidden">
    <input name="submit" value="Submit" id="submit_btn" type="submit">

</form>

```

PHP (Located above the header, file is .PHP)

```auto
<?
        
    $emailclass = "basictext";
    $username = "";
    $name = $_POST['name'];
    $address = $_POST['address'];
    $subject = "Customer Address Data";
    $to = "garth@allyvideo.com";
    
    $body = "From: $name_field
 E-Mail: $email_field
 Address:
 $address";

    

    if ($_POST['process'] == 1) {

        $pattern = '/.*@.*\..*/';
        $email = $_POST['email'];
        $urlname = urlencode($$_POST['username']);

        
        
        
        

        if (preg_match($pattern, $_POST['email']) > 0) {
            // Here's where you would store 
            // the data in a database...

            header(
              "location: thankyou_form.html");
              mail($to, $subject, $body);
              
        }
        else {
            header(
                "location: incomplete.html");
        }

    }
?>

```
