Web Analytics Made Easy -
StatCounter Help with sending forms - CodingForum

Announcement

Collapse
No announcement yet.

Help with sending forms

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with sending forms

    I'm having trouble sending all the information I need with a form. You can see the page at www.grpaint.com/estimate3.html

    I can get the Contact info sent everytime but the Type of Est and How they heard about our company or best time for est does not send.

    It will send if it is not in tables. But I need the tables to keep the format. The send script is PHP and I can provide a copy of that as well if needed.

    Please help me out.

    Thank you!

    Mike

  • #2
    You have two </form> tags but only one <form> tag.

    Comment


    • #3
      I took out the other </form> but i still have the same problem.

      Anymore suggestions please.

      Or if someone would like to write me the code really quick for this form to be sent that would be awesome too.

      Thank you,
      Last edited by grpaint; Oct 9, 2006, 02:46 PM.

      Comment


      • #4
        show us your form.php code

        Comment


        • #5
          Here it goes

          Code:
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml">
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
          <title>Untitled Document</title>
          </head>
          
          <body>
          <?php
          
          //general contact info
          
          $name = $_POST['name'];
          $phonenumber = $_POST['phonenumber'];
          
          //$data_order = $_POST['data_order'];
          
          $address = $_POST['address'];
          $city = $_POST['city'];
          $zip = $_POST['zip'];
          $email = $_POST['email'];
          $phonenumber = $_POST['phonenumber'];
          $besttime = $_POST['besttime'];
          
          //estimate info
          
          $estimateType[0] = $_POST['interior'];
          $estimateType[1] = $_POST['exterior'];
          $estimateType[2] = $_POST['deck'];
          $estimateType[3] = $_POST['powerwash'];
          $estimateType[4] = $_POST['gutter'];
          $estimateType[5] = $_POST['newconstruction'];
          
          $estimateName[0] = "-interior";
          $estimateName[1] = "-exterior";
          $estimateName[2] = "-deck";
          $estimateName[3] = "-powerwash";
          $estimateName[4] = "-gutter";
          $estimateName[5] = "-newconstruction";
          
          //how did you hear about us info
          $hearfrom[0] = $_POST['flyer'];
          $hearfrom[1] = $_POST['familycoupon'];
          $hearfrom[2] = $_POST['phonead'];
          $hearfrom[3] =$_POST['pastcustomer'];
          $hearfrom[4] = $_POST['referred'];
          $hearfrom[5] = $_POST['other'];
          
          
          $hear[0] = "-flyer";
          $hear[1] = "-family coupon";
          $hear[2] = "-phone ad";
          $hear[3] = "-past customer";
          $hear[4] = "-".$_POST['referred2'];
          $hear[5] = "-".$_POST['other2'];
          
          //Best time for est
          $estdate = $_POST['estdate'];
          $esttime = $_POST['esttime'];
          
          
          //organize Estimate Type
          $c=0;
          $c1=0;
          $est[5];
          while($c <= 5){
          if($estimateType[$c] == "on")
          	{
          	$est[$c1]=$estimateName[$c];
          	$c1++;
          	}
          	$c++;
          }
          //organize hear from type
          $hearfrom[5];
          $c=0;
          $c1=0;
          $ad[5];
          while($c <= 5){
          if($hearfrom[$c] == "on")
          	{
          	$ad[$c1]=$hear[$c];
          	$c1++;
          	}
          	$c++;
          }
          $letterBody=
          "customer's name: ".$name. "\n".
          "\n".
          "customer's phone number: ".$phonenumber."\n".
          "\n".
          "customer's address"."\n".
          $address."\n".
          $city.", ".$zip.
          "\n".
          "Email: ".$email."\n".
          "\n".
          "Phone Number: ".$phonenumber."\n".
          "Best time for calling is ".$besttime."\n".
          "Est Date: ".$estdate."\n".
          "Est Time: ".$esttime."\n".
          "\n".
          "Requesting estimates in:\n".
          $est[0]."\n".
          $est[1]."\n".
          $est[2]."\n".
          $est[3]."\n".
          $est[4]."\n".
          $est[5]."\n".
          "\n".
          "The following customer was refered to you by"."\n".
          $ad[0]."\n".
          $ad[1]."\n".
          $ad[2]."\n".
          $ad[3]."\n".
          $ad[4]."\n".
          $ad[5]."\n";
          $mailAddress = "[email protected]";
          $subject = "A GRpaint quote request from ".$name;
          //echo $letterBody;
          
          if (mail($mailAddress, $subject , $letterBody))
          {
             echo("<p>Message successfully sent!</p>");
          }
          else
          {
             echo("<p>Message delivery failed...</p>");
          }
          
          //mail($mailAddress, "New Quote request from".$name , $letterBody);
          ?>
          </body>
          </html>

          Comment


          • #6
            any ideas?

            Comment


            • #7
              Validate your html, see if that helps.

              Comment


              • #8
                I think that the problem he is having is that when he tries to format the email as a HTML table, instead of plain text, that it does not work. I think that his form code works and when he sends the email as plain text it works.

                To send the proper headers for a HTML email, check out example 4 at this link to the PHP manual - http://www.php.net/manual/en/function.mail.php
                Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.

                Comment


                • #9
                  Still didn't work. Here is the messed up part about it all. I currently have the script at www.grpaint.com/estimate.html and it works fine. The second I put it into tables, it won't work just the contact information but nothing about the estimate type or how they heard about us.

                  Anymore ideas?

                  Mike

                  Comment


                  • #10
                    Still didn't work.
                    What is working and what is not working? We can only see what you describe. Saying it didn't work does not help anyone here know what you see or what you are doing.

                    The second I put it into tables
                    What is the 'it" you are putting into a table?

                    Post the version of the code that does not work.
                    Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.

                    Comment


                    • #11
                      The parts that is wrong.

                      if you look at www.grpaint.com/estimate3.html you will see the form. (I've already posted the php)

                      When I have the form (on www.grpaint.com/estimate3.html) set inside of tables for formatting, when someone presses send it will only send me their name, address, phone..... but it won't send me the project type or how heard or best date, time for est.

                      Comment


                      • #12
                        After your first post, I copied and pasted the from code to my test server and tested it. Typing something into each field and putting a check in each box resulted in the following being sent to the form action = .php page:
                        Code:
                        Key: name, Value: a
                        Key: address, Value: b
                        Key: interior, Value: ON
                        Key: city, Value: c
                        Key: exterior, Value: ON
                        Key: zip, Value: d
                        Key: deck, Value: ON
                        Key: email, Value: e
                        Key: powerwash, Value: ON
                        Key: phonenumber, Value: f
                        Key: gutter, Value: ON
                        Key: besttime, Value: g
                        Key: newconstruction, Value: ON
                        Key: flyer, Value: ON
                        Key: estdate, Value: h
                        Key: familycoupon, Value: ON
                        Key: esttime, Value: i
                        Key: phonead, Value: ON
                        Key: pastcustomer, Value: ON
                        Key: referred, Value: ON
                        Key: referred2, Value: j
                        Key: other, Value: ON
                        Key: other2, Value: k
                        Key: required, Value: name,phonenumber
                        Key: data_order, Value: name, address, city, zip, email, phonenumber, besttime, interior, exterior, deck, powerwash, gutter, newconstruction, flyer, familycoupon, phonead, pastcustomer, referred, referred2, other, other2, estdate, esttime
                        Key: submit_to, Value: [email protected]
                        Key: automessage, Value: mymessage
                        Key: outputfile, Value: form1
                        Key: countfile, Value: form1
                        Key: emailfile, Value: form1
                        Key: form_id, Value: My Test Form
                        Key: ok_url, Value: http://www.grpaint.com/thankyou.html
                        Key: not_ok_url, Value: http://www.grpaint.com/error.html
                        Have you confirmed that the $_POST variable array contains or does not contain everything?

                        Edit: Upon further review, looking at the values received in the actual data and comparing this with the .php code, you are testing for the value "on", but the form produces "ON" and the compare statements will fail.
                        Last edited by CFMaBiSmAd; Oct 10, 2006, 05:32 PM.
                        Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.

                        Comment


                        • #13
                          I'll make a separate post with my findings -

                          I tried your "working" form code and it gives "on" values. These result from the default values from check boxes.

                          Whoever wrote your table based form, specifically put this coding in value="ON" which is what broke your .php form processing code. It is not the actual use of a table that caused it but a specific change in the checkbox statements...
                          Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.

                          Comment

                          Working...
                          X