38 users online (0 members and 38 guests)  

Thread: PHP email form.


  Results 1 to 3 of 3

Related

  1. Need help with form going to email.    Forum: HTML Forum
    Replies: 1
  2. PHP Form email    Forum: PHP Forum
    Replies: 2
  3. Simple email form    Forum: HTML Forum
    Replies: 6
  4. JS Email Form    Forum: Javascript Forum
    Replies: 4
  5. Please help with email form script    Forum: PHP Forum
    Replies: 1
  1. #1
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76

    PHP email form.

    hey everyone,
    long time, no post. i'm stuck once again on something that's probably extremely easy to figure out. i'm cashing in my old CGI form mailer script for a PHP script. here's my form:

    <form action="submission.php" method="post" name="form" id="form">
    <table width="300" border="0" align="center" cellpadding="0" cellspacing="0" id="white">
    <tr>
    <td width="90" align="right" valign="middle">first name:&nbsp;</td>
    <td align="left" valign="middle"> <input name="first_name" type="text" id="first_name" size="40">
    </td>
    </tr>
    <tr>
    <td width="90" align="right" valign="middle">last name:&nbsp;</td>
    <td align="left" valign="middle"> <input name="last_name" type="text" id="last_name" size="40">
    </td>
    </tr>
    <tr>
    <td width="90" align="right" valign="middle">age:&nbsp;</td>
    <td align="left" valign="middle"><input name="age" type="text" id="age" size="40"></td>
    </tr>
    <tr>
    <td width="90" align="right" valign="middle">email:&nbsp;</td>
    <td align="left" valign="middle"><input name="email" type="text" id="email" size="40"></td>
    </tr>
    <tr>
    <td width="90" align="right" valign="middle">website:&nbsp;</td>
    <td align="left" valign="middle"><input name="website" type="text" id="name" size="40"></td>
    </tr>
    <tr>
    <td width="90" align="right" valign="middle">how did you find us?&nbsp;</td>
    <td align="left" valign="middle"><input name="how" type="text" id="last_name3" size="40"></td>
    </tr>
    <tr>
    <td width="90" align="right" valign="middle">&nbsp; </td>
    <td align="left" valign="top">
    <input type="submit" name="submit" value="submit">
    <input type="reset" name="reset" value="reset">
    </td>
    </tr>
    </table>
    </form>




    and here's my submission page code:

    <?php

    if ($REQUEST_METHOD=="POST") {

    } else {

    if ($first_name=="" or $last_name=="" or $age=="" or $email=="" or $website="" or $how="") {

    echo "we need you to fill out the entire form, <a href='javascript:history.go(-1)'>go back</a> and try again.";

    } else {

    $to = "vent@theburningtree.com";
    $from = "from: \"$first_name\" <$email>";
    $subject = "VENT/// submission";
    $message = "$first_name, $last_name, $age, $website, $how";
    $additional = "$from\r\nReply-To: $email\r\nContent-Type: text/html; charset=iso-8859-1";

    mail($to, $subject, $message, $additional);
    echo "hello $first_name, thanks for your submission. we'll be contacting you soon.";

    }
    }
    ?>


    i'm not getting any errors. it's just not working. i'm stumped. thanks!
    robert koons

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi Rob.

    this bit -

    Code:
    if ($REQUEST_METHOD=="POST") {
    
    what goes here?
    
    
    } else {
    Doesn't that mean that if the request method is POST then do nothing?

    To test add echo "uh oh!"; instead of the line I have marked in red. If it echos, you know to move your 'else' clause.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76
    it's working now.

    i was thinking about it.. if i know the form it using POST, then why do i need to check it in the submission script?

    i deleted it and everything is working. as always thanks for the help!
    robert koons



Tags for this Thread