Need Help with Form - Willing to $TIP$ the individual who figures this out

Discussion in 'PHP' started by kevin_laurentian, Sep 19, 2010.

  1. #1
    Hi, I've been trying to get a contact form to work for the past 8 hours, and my brain is simply spinning at this point.

    My form has many fields, text, drop down options and so on. My issue is that the email it sends me only has the data from one feild. I'm not sure what I'm supposed to post on here in order to get help but any individuals could tell me what to post, i'll post it and the individual who figures out my problem will get a small reward for their efforts.

    This is likely very simple, but this is my first attempt at php therefore, im lost! I tried adding $other fields =request........ but nothing is working. below is my sendmail.php

    <?php
    $email = $_REQUEST['email'] ;
    $name = $_REQUEST['name'] ;

    mail( "myemail@hotmail.com", "quote request",
    $name, "From: $email" );
    header( "Location: http://www.domain.com/success.html" );
    ?>


    and my form code is from my page html is

    <form name="Online Quote Request" method="POST" action="sendmail.php" enctype="multipart/form-data" id="Form2">
    <div id="bv_Text14" style="position:absolute;left:28px;top:326px;width:299px;height:16px;z-index:0;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>When Would You Like Construction to Begin?</b></font></div>
    <div id="bv_Text5" style="position:absolute;left:27px;top:86px;width:271px;height:16px;z-index:1;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Company Name</b></font></div>
    <div id="bv_Text2" style="position:absolute;left:29px;top:23px;width:271px;height:16px;z-index:2;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Email:</b></font></div>
    <input type="text" id="Editbox2" style="position:absolute;left:137px;top:22px;width:201px;font-family:Courier New;font-size:16px;z-index:3" name="email" value="">
    <div id="bv_Text1" style="position:absolute;left:27px;top:55px;width:271px;height:16px;z-index:4;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Name</b></font></div>
    <input type="text" id="Editbox1" style="position:absolute;left:137px;top:51px;width:201px;font-family:Courier New;font-size:16px;z-index:5" name="name" value="">
    <input type="text" id="Editbox4" style="position:absolute;left:137px;top:80px;width:201px;font-family:Courier New;font-size:16px;z-index:6" name="Editbox3" value="">
    <div id="bv_Text3" style="position:absolute;left:27px;top:115px;width:271px;height:16px;z-index:7;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Address</b></font></div>
    <input type="text" id="Editbox3" style="position:absolute;left:137px;top:109px;width:200px;font-family:Courier New;font-size:16px;z-index:8" name="Editbox4" value="">
    <div id="bv_Text7" style="position:absolute;left:27px;top:146px;width:271px;height:16px;z-index:9;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>City</b></font></div>
    <input type="text" id="Editbox6" style="position:absolute;left:137px;top:138px;width:200px;font-family:Courier New;font-size:16px;z-index:10" name="Editbox5" value="">
    <div id="bv_Text6" style="position:absolute;left:385px;top:24px;width:271px;height:16px;z-index:11;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Postal Code</b></font></div>
    <input type="text" id="Editbox5" style="position:absolute;left:493px;top:22px;width:200px;font-family:Courier New;font-size:16px;z-index:12" name="Editbox6" value="">
    <div id="bv_Text9" style="position:absolute;left:385px;top:81px;width:271px;height:16px;z-index:13;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Phone Number</b></font></div>
    <input type="text" id="Editbox8" style="position:absolute;left:493px;top:79px;width:200px;font-family:Courier New;font-size:16px;z-index:14" name="Editbox7" value="">
    <div id="bv_Text8" style="position:absolute;left:385px;top:109px;width:271px;height:16px;z-index:15;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Fax Number</b></font></div>
    <input type="text" id="Editbox7" style="position:absolute;left:494px;top:108px;width:200px;font-family:Courier New;font-size:16px;z-index:16" name="Editbox8" value="">
    <div id="bv_Text10" style="position:absolute;left:384px;top:53px;width:271px;height:16px;z-index:17;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Province/State</b></font></div>
    <div id="bv_Text11" style="position:absolute;left:28px;top:217px;width:271px;height:16px;z-index:18;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Do You Have Land?</b></font></div>
    <select name="Combobox1" size="1" id="Combobox2" style="position:absolute;left:493px;top:215px;width:200px;font-family:Courier New;font-size:16px;z-index:19">
    <option value="Yes">Yes</option>
    <option value="No">No</option>
    <option selected value="Please Select">Please Select</option>
    </select>
    <div id="bv_Text12" style="position:absolute;left:28px;top:254px;width:271px;height:16px;z-index:20;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Do You Have Financing?</b></font></div>
    <select name="Combobox2" size="1" id="Combobox1" style="position:absolute;left:493px;top:251px;width:200px;font-family:Courier New;font-size:16px;z-index:21">
    <option value="Yes">Yes</option>
    <option value="No">No</option>
    <option selected value="Please Select">Please Select</option>
    </select>
    <div id="bv_Text13" style="position:absolute;left:28px;top:291px;width:271px;height:16px;z-index:22;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Do You Have a Building Permit?</b></font></div>
    <select name="Combobox3" size="1" id="Combobox4" style="position:absolute;left:494px;top:284px;width:200px;font-family:Courier New;font-size:16px;z-index:23">
    <option value="Yes">Yes</option>
    <option value="No">No</option>
    <option selected value="Please Select">Please Select</option>
    </select>
    <select name="Combobox4" size="1" id="Combobox3" style="position:absolute;left:494px;top:318px;width:200px;font-family:Courier New;font-size:16px;z-index:24">
    <option value="< 3 months">< 3 months</option>
    <option value="Between 3 and 6 months">Between 3 and 6 months</option>
    <option value="> 6 Months and < 1 Year">> 6 Months and < 1 Year</option>
    <option value="> 1 Year">> 1 Year</option>
    <option>> 1 Year and < 2 Years</option>
    <option value="> 2 Years">> 2 Years</option>
    <option value="Unknown">Unknown</option>
    </select>
    <div id="bv_Text15" style="position:absolute;left:27px;top:360px;width:271px;height:16px;z-index:25;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>The Anticipated Square Footage Will Be?</b></font></div>
    <select name="Combobox5" size="1" id="Combobox6" style="position:absolute;left:494px;top:353px;width:200px;font-family:Courier New;font-size:16px;z-index:26">
    <option value="< 5000">< 5000</option>
    <option value="5000 - 10 000">5000 - 10 000</option>
    <option value="50 000">10 000</option>
    <option value="50 000 - 100 000">50 000 - 100 000</option>
    <option value="> 100 000">> 100 000</option>
    </select>
    <div id="bv_Text16" style="position:absolute;left:27px;top:393px;width:271px;height:16px;z-index:27;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Approximate Dimensions</b></font></div>
    <input type="text" id="Editbox10" style="position:absolute;left:493px;top:387px;width:200px;font-family:Courier New;font-size:16px;z-index:28" name="Editbox11" value="">
    <div id="bv_Text17" style="position:absolute;left:27px;top:427px;width:271px;height:16px;z-index:29;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Type of Building</b></font></div>
    <select name="Combobox6" size="1" id="Combobox5" style="position:absolute;left:493px;top:421px;width:200px;font-family:Courier New;font-size:16px;z-index:30">
    <option value="Small Commerical">Small Commerical</option>
    <option value="Large Commerical">Large Commerical</option>
    <option value="Institutional">Institutional</option>
    <option value="Health Related">Health Related</option>
    <option value="Recreational">Recreational</option>
    <option value="Manufacturing">Manufacturing</option>
    <option value="Warehouse">Warehouse</option>
    <option value="Special">Special</option>
    <option value="Retrofit">Retrofit</option>
    <option value="Agricultural">Agricultural</option>
    <option value="Other">Other</option>
    </select>
    <div id="bv_Text18" style="position:absolute;left:28px;top:500px;width:271px;height:16px;z-index:31;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Additional Comments</b></font></div>
    <textarea name="TextArea1" id="TextArea2" style="position:absolute;left:277px;top:500px;width:421px;height:119px;font-family:Courier New;font-size:16px;z-index:32" rows="5" cols="38"></textarea>
    <div id="bv_Text19" style="position:absolute;left:28px;top:645px;width:271px;height:16px;z-index:33;" align="left">
    <font style="font-size:13px" color="#000000" face="Arial"><b>Please Enter the Captcha Code</b></font></div>
    <div id="bv_Captcha2" style="position:absolute;left:321px;top:623px;width:200px;height:38px;z-index:34;" align="left">
    <img src="captcha2.php" alt="Click for new image" title="Click for new image" style="cursor:pointer;width:100px;height:38px;" onclick="this.src='captcha2.php?'+Math.random()">
    <input type="text" id="Captcha2Edit" style="position:absolute;left:105px;top:14px;width:100px;font-family:Courier New;font-size:16px;" name="captcha_code" value=""></div>
    <input type="submit" id="Button2" name="Button1" value="Send" style="position:absolute;left:602px;top:638px;width:96px;height:25px;font-family:Arial;font-size:13px;z-index:35">
    <input type="text" id="Editbox9" style="position:absolute;left:493px;top:51px;width:200px;font-family:Courier New;font-size:16px;z-index:36" name="Editbox9" value="">
    <div id="bv_Shape4" style="position:absolute;left:23px;top:172px;width:669px;height:26px;z-index:37;" align="center">
    <img src="images/bv01117.gif" id="Shape4" align="top" alt="" title="" border="0" width="669" height="26"></div>
    <div id="bv_Shape7" style="position:absolute;left:24px;top:457px;width:669px;height:26px;z-index:38;" align="center">
    <img src="images/bv01119.gif" id="Shape7" align="top" alt="" title="" border="0" width="669" height="26"></div>

    </form>
     
    kevin_laurentian, Sep 19, 2010 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    Which field is it sending you ?

    ...and is this all you have to collect the information ?
    $email = $_REQUEST['email'] ;
    $name = $_REQUEST['name'] ;
    PHP:
    If you can reply with those answers, we can sort that out, but another point would be, I don't think you can use a from @hotmail account, but we can come to that again...
     
    Last edited: Sep 19, 2010
    MyVodaFone, Sep 19, 2010 IP
  3. kevin_laurentian

    kevin_laurentian Peon

    Messages:
    76
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If i remember correctly (if i put it a email of ) it will send a email with the correct subject line and the word admin in the body of the email.

    Yes it is the only info i have to gather the data from the form...until last night, i've never touched php and i cant get a grasp on it....trying many things and nothing is working. , i know i'm missing stuff but i have no idea how to go about it? If you're willing to sort it out , i'll be more than happy to send you a little something via paypal.
     
    Last edited: Sep 19, 2010
    kevin_laurentian, Sep 19, 2010 IP
  4. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #4
    This should give you the idea of what your missing, try it with your hotmail address, you will see how it works. ie: the name of each input box give the $_Request a value and that value gets sent in the mail.

    
    <?php
    $email = $_REQUEST['email'] ;
    $message = "From: ".$_REQUEST['$name']."\r\nEmail: ".$_REQUEST['email']."\r\nEditbox3: ".$_REQUEST['Editbox3']."\r\nEditbox4: ".$_REQUEST['Editbox4']."\r\nMessage: This form was submitted from http://{$_SERVER['HTTP_HOST']}";
    
    mail( "myemail@hotmail.com", "quote request",
    $message, "From: $email" );
    header( "Location: http://www.domain.com/success.html" );
    ?>
    
    PHP:
     
    MyVodaFone, Sep 19, 2010 IP
  5. jocurileus

    jocurileus Peon

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    here are your data fields
    email, name, Editbox3, Editbox4, Editbox5, Editbox6, Editbox7, Editbox8, Combobox1, Combobox2, Combobox3, Combobox4, Combobox5, Editbox11, Combobox6, TextArea1, captcha_code, Button1, Editbox9
    Code (markup):
    All this can be accesed in php trough the use of a superglobal like this
    $_POST["email"] (or $_REQUEST["email"]) contains the information from the email field in your form
    $_POST["name"] contains the information from the names field and so fourth.
    All you have to do is unite all the pieces of information together, to stick variables and text together in php you can use the . (dot) like this:
     "This is the email ".$_POST["email"]." and this is the name ".$_POST["name"];
    PHP:
    I hope you understand what I wrote you.
    I am new to this forums but I can see that people want you to learn and that's why i wont provide you with the code readily done. Good luck!
     
    jocurileus, Sep 19, 2010 IP
  6. ZachF

    ZachF Guest

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi,

    I'm not sure how familiar you are with PHP but i reccomend doing something like this for your form.

    Use method POST in your form action.

    Then on the form submission page, for each form field you need to GET it. Example

    $one = $_GET['name'];
    $two = $_GET['address'];
    $three = $_GET['phone'];
    $four = $_GET['email'];
    $five = $_GET['password'];

    those variables can now be placed in your email message and will show the users inputs for those fields.
     
    ZachF, Sep 19, 2010 IP
  7. jocurileus

    jocurileus Peon

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    @ZachF try not to confuse others with erroneous information. You can't fetch data from a form which uses POST with $_GET, you have to use $_POST or $_REQUEST which counts for both $_POST and $_GET (and $COOKIE but it's irrelevant here)
     
    jocurileus, Sep 20, 2010 IP