Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Email Form Error

  1. #1
    Join Date
    Jan 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Email Form Error

    Hi everyone, I'm new. Right now I am designing a site for someone, Qualityremodelinginc.net. Keep in mind it's under construction, but I need help on the Estimate page. He wants a form that people can fill out their information and check what services they need an estimate for, and click submit and there should be one new email in his box. I have read some tutorials, but it still doesnt work. This is what my form html looks like now, or you can preview it at Qualityremodelinginc.net/Estimates.html

    ----------------------------------------

    </body>

    <li>
    <p align="left"><font size="5"><font color="#663300">Phone:</font> (773)
    509-0200</font>
    <li>
    <p align="left"><font size="5"><font color="#663300">Fax:</font> (773)
    539-2177</font>
    </ul>


    <form method="POST" action="contact.php">

    <p style="text-align: left"><b>First Name:
    </b>
    <input type="text" name="First">
    <p style="text-align: left"><b>Last Name:
    </b>
    <input type="text" name="Last">
    <p style="text-align: left"><b>Address:
    </b>
    <input type="text" name="Address" size="48"><b>

    Unit #:</b><input type="text" name="Address0" size="21"><p style="text-align: left">
    <b>City:</b>
    <input type="text" name="City">
    <p style="text-align: left"><b>State:
    </b>
    <input type="text" name="State">
    <p style="text-align: left"><b>Zip:
    </b>
    <input type="text" name="Zip">
    <p style="text-align: left"><b>Phone:
    </b>
    <input type="text" name="Telephone">&nbsp;&nbsp; <b>Cell: </b>
    <input type="text" name="Cell">&nbsp; <b>Work:</b>
    <input type="text" name="Work">
    <p style="text-align: left"><b>Email:</b>
    <input type="text" name="Email" size="48"><br>
    <br>

    <b>Services Requested:</b><form method="post" action="form.php">
    <p style="text-align: left">
    <input type="checkbox" name="services[]" value="Kitchen">Kitchen</input><br>
    <input type="checkbox" name="services[]" value="Bathroom">Bathroom</input><br />
    <input type="checkbox" name="services[]" value="Basement">Basement</input><br />
    <input type="checkbox" name="services[]" value="Porch/Deck">Porch/Deck</input><br />
    <input type="checkbox" name="services[]" value="Roofing">Roofing</input><br />
    <input type="checkbox" name="services[]" value="Room Addition">Room Addition</input><br />
    <input type="checkbox" name="services[]" value="Dormer/Attic">Dormer/Attic</input><br />
    <input type="checkbox" name="services[]" value="Siding">Siding</input><br />
    <input type="checkbox" name="services[]" value="Windows">Windows</input><br />
    <input type="checkbox" name="services[]" value="Tuckpointing">Tuckpointing</input></p>
    <p style="text-align: left">Other:
    <input type="text" name="Other"><br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="submit" name="submit" value="Submit" />

    </form>
    <p>

    ----------------------------------------


    And then I heard you need a contact.php page so I made one. I didn't really edit this while I edited the form, so it matches the original (which is totally different!) Well here is the Contact.php html

    <?php // contact.php

    if (isset($_POST['services']))
    {
    echo "You chose: " . join(', ', $_POST['services']) . ".\n";
    }

    echo "<br />\n";
    echo "<a href=\"Error.html\">Choose again</a>\n";


    // get posted data into local variables
    $EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
    $EmailTo = "Jkk088@sbcglobal.net";
    $Subject = Trim(stripslashes($_POST['Subject']));
    $First = Trim(stripslashes($_POST['First']));
    $Last = Trim(stripslashes($_POST['Last']));
    $Company = Trim(stripslashes($_POST['Company']));
    $Address = Trim(stripslashes($_POST['Address']));
    $Telephone = Trim(stripslashes($_POST['Telephone']));
    $Mobile = Trim(stripslashes($_POST['Mobile']));
    $Website = Trim(stripslashes($_POST['Website']));

    // validation
    $validationOK=true;
    if (Trim($EmailFrom)=="") $validationOK=false;
    if (Trim($First)=="") $validationOK=false;
    if (Trim($Last)=="") $validationOK=false;
    if (!$validationOK) {
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    exit;
    }

    // prepare email body text
    $Body = "";
    $Body .= "First: ";
    $Body .= $First;
    $Body .= "\n";
    $Body .= "Last: ";
    $Body .= $Last;
    $Body .= "\n";
    $Body .= "Company: ";
    $Body .= $Company;
    $Body .= "\n";
    $Body .= "Address: ";
    $Body .= $Address;
    $Body .= "\n";
    $Body .= "Telephone: ";
    $Body .= $Telephone;
    $Body .= "\n";
    $Body .= "Mobile: ";
    $Body .= $Mobile;
    $Body .= "\n";
    $Body .= "Website: ";
    $Body .= $Website;
    $Body .= "\n";

    // send email
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

    // redirect to success page
    if ($success){
    print "<meta http-equiv=\"refresh\" content=\"0;URL=Thanks.html\">";
    }
    else{
    print "<meta http-equiv=\"refresh\" content=\"0;URL=Error.html\">";
    }
    ?>



    ----------------------------------------


    Well I hope you all can help cause I am pretty clueless. Thank you SO much, and you all are very intelligent. Thanks again. My email is Jkk088@sbcglobal.net and my aim is Jkk088. So im me or email me. This form is very important to me and I know you guys can help.

    //JK
    Last edited by jkswebsite; 01-08-2007 at 02:46 AM. Reason: Divider

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    What's the error that you are getting? The only thing that I can see that's wrong with it (just glancing at it) is the fact that you close the php tag twice.

    The following (in red) should be removed:

    Code:
    echo "<a href=\"Error.html\">Choose again</a>\n";
    ?>
    
    // get posted data into local variables
    Remove that, then post the error that you are getting (if any) and it will probably get resolved.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jan 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Okay thank you, I changed it but it still doesnt work. Any other changes I could make?

  4. #4
    Join Date
    Jan 2007
    Location
    Sweden
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    can u save php in a .html?

  5. #5
    Join Date
    Jan 2007
    Location
    Sweden
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    and i would recommend usin CSS

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Quote Originally Posted by NineTwoZero
    can u save php in a .html?
    No, the php code will appear as plain text, you have to have the .php extension in your file name.
    - Mike

  7. #7
    Join Date
    Jan 2007
    Location
    Sweden
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    well thats his problem.. he's saved everything as a .html..

  8. #8
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by mburt View Post
    No, the php code will appear as plain text, you have to have the .php extension in your file name.
    You actually could save php code as HTML, but you would need to change the MIME type

    application/x-httpd-php .html
    in the httpd.conf file. But normally you cannot save it as HTML.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  9. #9
    Join Date
    Jan 2007
    Location
    Sweden
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    well i dont think he did that(changed MIMEtype).. but we'll have to wait until he gets back to know for sure

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Not the issue at all. The first page is just html.

    The action of the form (page it is sent to) is 'contact.php'. Read the comment after the <?php tag in the first post.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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