The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 2 of 2

Thread: noob needs help with contact form tutorial

  1. #1

    noob needs help with contact form tutorial

    I have been trying to use an adapted version of the tututorial with no luck. I know the server is running php. When I submit the form I get the "data not sent" branch of the logic no matter what I do. I would appreciate any help you can offer.

    Here is my form:

    <form action="sysmail.php" method="post" name="sysmail">
    <fieldset>
    <legend>Personal Information:</legend>
    <label>First name: </label>
    <input type="text" id="firstname" name="firstname" value="" title="firstname" /><br />
    <label>Last name: </label>
    <input type="text" id="lastname" name="lastname" title="lastname" /><br />
    <label>Email: </label>
    <input type="text" id="email" name="email" title="email" /><br />
    <br />
    <label>Company: </label>
    <input type="text" id="company" name="company" title="company" /><br />
    <label>Address1: </label>
    <input type="text" id="address1" name="address1" title="address1" /><br />
    <label>Address2: </label>
    <input type="text" id="address2" name="address2" title="address2" /><br />
    <br />
    <label>City: </label>
    <input type="text" id="city" name="city" title="city" /><br />

    <label>State:</label>
    <select name="drop_down" size="1" id="drop_down" title="drop_down">
    <option value="" selected="selected">Choose
    </option><option value="AL">Alabama
    </option><option value="AK">Alaska
    </option><option value="AZ">Arizona
    </option><option value="AR">Arkansas
    </option><option value="CA">California
    </option><option value="CO">Colorado
    </option><option value="CT">Connecticut
    </option><option value="DE">Delaware
    </option><option value="DC">District Of Columbia
    </option><option value="FL">Florida
    </option><option value="GA">Georgia
    </option><option value="HI">Hawaii
    </option><option value="ID">Idaho
    </option><option value="IL">Illinois
    </option><option value="IN">Indiana
    </option><option value="IA">Iowa
    </option><option value="KS">Kansas
    </option><option value="KY">Kentucky
    </option><option value="LA">Louisiana
    </option><option value="ME">Maine
    </option><option value="MD">Maryland
    </option><option value="MA">Massachusetts
    </option><option value="MI">Michigan
    </option><option value="MN">Minnesota
    </option><option value="MS">Mississippi
    </option><option value="MO">Missouri
    </option><option value="MT">Montana
    </option><option value="NE">Nebraska
    </option><option value="NV">Nevada
    </option><option value="NH">New Hampshire
    </option><option value="NJ">New Jersey
    </option><option value="NM">New Mexico
    </option><option value="NY">New York
    </option><option value="NC">North Carolina
    </option><option value="ND">North Dakota
    </option><option value="OH">Ohio
    </option><option value="OK">Oklahoma
    </option><option value="OR">Oregon
    </option><option value="PA">Pennsylvania
    </option><option value="RI">Rhode Island
    </option><option value="SC">South Carolina
    </option><option value="SD">South Dakota
    </option><option value="TN">Tennessee
    </option><option value="TX">Texas
    </option><option value="UT">Utah
    </option><option value="VT">Vermont
    </option><option value="VA">Virginia
    </option><option value="WA">Washington
    </option><option value="WV">West Virginia
    </option><option value="WI">Wisconsin
    </option><option value="WY">Wyoming
    </option></select><br />

    <label>ZIP: </label>
    <input type="text" id="zip" name="zip" title="zip" /><br />
    <label>Country: </label>
    <input type="text" id="country" name="country" title="country" /><br />
    <br />
    <label>Phone: </label>
    <input type="text" id="phone" name="phone" title="phone" /><br />
    <label>FAX: </label>
    <input type="text" id="fax" name="fax" title="fax" /><br />
    </fieldset>
    <fieldset>
    <legend>Please enter your inquiry in the field below:</legend>
    <label>Comments: </label>
    <textarea name="comments" rows="3" cols="23" id="comments" title="comments"></textarea><br />
    <label></label>
    <input type="submit" value="Send" id="submit" /> <INPUT type="reset" id="reset" />
    </fieldset>
    </form>

    Here is my script:

    <?php
    if(isset($_POST['submit'])) {

    $to = "b.obama@att.net";
    $subject = "Dye Systems Website Inquiry";
    $firstname_field = $_POST['firstname'];
    $lastname_field = $_POST['lastname'];
    $email_field = $_POST['email'];
    $company_field = $_POST['company'];
    $address1_field = $_POST['address1'];
    $address2_field = $_POST['address2'];
    $city_field = $_POST['city'];
    $dropdown = $_POST['drop_down'];
    $zip_field = $_POST['zip'];
    $country_field = $_POST['country'];
    $phone_field = $_POST['phone'];
    $fax_field = $_POST['fax'];
    $comments_field = $_POST['comments'];

    $body = "From: $firstname_field\n $lastname_field\n E-Mail: $email_field\n Company: $company_field\n Address1: $address1_field\n Address2: $address2_field\n City: $city_field\n Drop-Down: $dropdown\n ZIP: $zip_field\n Country: $country_field\n Phone: $phone_field\n FAX: $fax_field\n Comments: $comments_field\n";

    echo "Data has been submitted to $to!";
    mail($to, $subject, $body);

    } else {
    echo "Error. Please Try Once More.";
    }
    ?>


    Thanks so much for your help

  2. #2
    change
    HTML Code:
    <input type="submit" value="Send" id="submit" />
    to:
    HTML Code:
    <input type="submit" name="submit" value="Send" id="submit" />
    to explain why:
    you're looking for the post variable "submit" with php... altho in your form, there is none... so it will never pass the first if statement.

    apply changed above, so you will have a "submit" variable in your form.
    Last edited by RvGaTe; August 16th, 2009 at 12:34 PM. Reason: quotes

    You can never underestimate the stupidity of the general public.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012