PHP Form sending blank

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nicole Frenkel
    New Member
    • Dec 2011
    • 2

    PHP Form sending blank

    Hi,

    I made a php form and when it sends the data is blank.

    it just shows

    Name:
    Email:
    Number:
    Comments:

    Help!!!!!!!!!

    Thanks!!


    <?php

    /* Subject and Email Variables */

    $emailSubject = 'TheChallahFair y!';
    $webMaster = 'nicole.frenkel @gmail.com';

    /* Gathering Data Variables */

    $nameField = $_POST['name'];
    $numberField = $_POST['number'];
    $emailField = $_POST['email'];
    $commentsField = $_POST['comments'];

    $body = <<<EOD
    <br><hr><br>
    Name: $name <br>
    Number: $number <br>
    Email: $email <br>
    Comments: $comments <br>
    EOD;

    $headers = "From: $email\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster , $emailSubject, $body, $headers);






    <form action="contact sending.php" method="post" name="form" id="form">
    <p>&nbsp;</p>
    <p>Name<br />
    <input name="name" type="text" size="30" id="name" />
    <br />
    <br />
    Telephone Number<br />
    <input name="number" type="text" size="30" id="number" />
    <br />
    <br />
    Email Address<br />
    <input name="email" type="text" size="20" id="email" />
    <br />
    <br />
    Comments<br />
    <textarea name="comments" cols="40" rows="8" id="comments">
    </textarea>
    <br />
    <br />
    <input type="submit" value="Send" />
    </p>
    </form>
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    That's because your variable is called $nameField, not $name, etc.

    Comment

    • Ammu
      New Member
      • Aug 2011
      • 78

      #3
      You can use
      echo "Name:";
      echo $name;
      echo "<br>";

      OR

      echo "Name:".$_P OST['name'];

      Comment

      • Nicole Frenkel
        New Member
        • Dec 2011
        • 2

        #4
        Thank you it worked!

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Please mark the post that worked as the answer.

          Comment

          Working...