[RESOLVED] $_POST values not set
Results 1 to 3 of 3

Thread: [RESOLVED] $_POST values not set

  1. #1
    Shamola
    Join Date
    Dec 2007
    Posts
    44

    resolved [RESOLVED] $_POST values not set

    Hi There,

    I am experimenting with an email form but the $_POST values are not set. The mail.php script is called correctly but the variables I try to use within the email body are empty.

    var_dump($_POST); returns me an empty array - (0) { } - so I am clearly doing something wrong.

    Here's the code for the form:
    HTML Code:
    							<FORM action="mail.php" method="post" enctype="text/plain">
    <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="4" WIDTH="90%">
    <TR>
    <TD width="30%"><DIV align="right"><B>Name:</B></DIV>
    <TD width="70%">
      <INPUT type="text" name="name" id="name" size="40">
     </TD>
    </TR>
    <TR>
      <TD width="30%"><DIV align="right"><B>Email:</B></DIV>
      </TD>
      <TD width="70%">
      <INPUT type="text" name="email" id="email" size="40">
      </TD>
    </TR>
    <TR>
    <TD width="30%"><DIV align="right"><B>Can you make it?:</B></DIV>
      <TD><select name="attendance" id="attendance" accesskey="1" tabindex="1">
        <option>Sorry can't make</option>
         <option>Yes can't wait</option>
      </select></TD>
    </TR>
    <TR>
    <TD><DIV align="right">
      <p><B>Names if attending</B><B>:</B></p>
    </DIV>
    </TD>
    <TD><TEXTAREA name="names" id="names" cols="30" wrap="virtual" rows="4">
    </TEXTAREA>
    </TD></TR>
    <TR>
     <TD width="30%"><DIV align="right"><B>Any dietry requirements?</B></DIV>
     <TD><TEXTAREA name="dietry" id="dietry" cols="30" wrap="virtual" rows="4">
    </TEXTAREA>
    </TD>
    </TR>
    <TR>
    <TD>&nbsp;</TD>
    <TD>
    <INPUT type="submit" name="submit" value="Submit">
    <INPUT type="reset" name="reset" value="Reset">
    </TD></TR>
    </TABLE>
    </FORM>
    And here's the php script:
    PHP Code:
    <?php

     $name
    $_POST['name'];
     
    $email=$_POST['email'];
     
    $attendance=$_POST['attendance'];
     
    $names=$_POST['names'];
     
    $diet=$_POST['dietry'];
     
    $to "somone@somewhere.com";
     
    $subject "RSVP";
     
    $body "Name:'$name'
     \n\n Email='
    $email'
     \n\n Attendance='
    $attendance'
     \n\n Names='
    $names'
     \n\n Dietry='
    $diet';";

    var_dump($_POST); 
     if (
    mail($to$subject$body)) {
       echo(
    "<p>Message successfully sent!</p>");
      } else {
       echo(
    "<p>Message delivery failed...</p>");
      }
    ?>
    All help appreciated.
    Tim.

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,390
    Remove the 'enctype="text/plain"' from the <form> tag.

  3. #3
    Shamola
    Join Date
    Dec 2007
    Posts
    44
    Thank you!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •