7 Replies Latest reply on Mar 18, 2010 7:11 PM by karina1717

    My form does not work:-(

    karina1717 Level 1

      I created this form in Dreamweaver using html and php to receive emails after people entered their data. I receive the email but not the data:

       

      http://www.hopropertymanagement.com/contact.html

        • 1. Re: My form does not work:-(
          nmbnmb Level 2

          Your form has no validations, therefore, it is possible to submit blank submissions. This could explain for the blank submissions. Do you get data in the email if the form is filled out?

          • 2. Re: My form does not work:-(
            karina1717 Level 1

            I tried doing validation work but it still enters empty information

            • 3. Re: My form does not work:-(
              hans-g. Adobe Community Professional & MVP

              Hi karina,

               

              sometimes it would be better to start all over again. Here you will find a wonderful step-by-step tutorial:

               

              http://dreamweaverspot.com/adobe-dreamweaver-tutorial-contact-forms/

               

              Hans-G.

              • 4. Re: My form does not work:-(
                nmbnmb Level 2

                We will need to view the script (contactformprocess.php) to see what is wrong with it. In the meantime:

                 

                Check that the script is using $_POST and not $_GET.

                Check that the field names in the script match with the field names in the form.

                • 5. Re: My form does not work:-(
                  karina1717 Level 1

                  <?php

                  /* Subject and Email Variables */

                       $emailSubject = 'Crazy PHP Scripting!';
                       $webMaster = 'info@hopropertymanagement.com';

                   

                  /* Gathering Data Variables */

                   

                       $firstnameField = $_POST['firstname'];
                       $lastnameField = $_POST['lastname'];
                       $emailField = $_POST['email'];
                       $phoneField = $_POST['phone'];
                       $informationField = $_POST['information'];
                       $commentsField = $_POST['comments'];

                   

                       $body = <<<EOD
                  <br><hr><br>
                  First Name: $firstname <br>
                  Last Name: $lastname <br>
                  Email: $email <br>
                  Phone: $phone <br>
                  Information: $information <br>
                  Comments: $comments <br>
                  EOD;

                   

                       $headers = "From: $email\r\n";
                       $headers .= "Content-type: text/html\r\n";
                       $success = mail($webMaster, $emailSubject, $body, $headers);

                   

                  /* Results Rendered as HTML */

                       $theResults = <<<EOD
                  <html>
                  <head>
                  <title>Thanks for Contacting Us</title>
                  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                  <style type="text/css">
                  <!--
                  body {
                       background-color: #f1f1f1;
                       font-family: Verdana, Arial, Helvetica, sans-serif;
                       font-size: 12px;
                       font-style: normal;
                       line-height: normal;
                       font-weight: normal;
                       color: #666666;
                       text-decoration: none;
                  }
                  -->
                  </style>
                  </head>

                   

                  <div>
                    <div align="left">Thank you for your interest! Your email will be answered very soon!</div>
                  </div>
                  <script type="text/javascript">
                  var gaJsHost = (("https:" == document.location.protocol) ?
                  "https://ssl." : "http://www.");
                  document.write(unescape("%3Cscript src='" + gaJsHost +
                  "google-analytics.com/ga.js'
                  type='text/javascript'%3E%3C/script%3E"));
                  </script>
                  <script type="text/javascript">
                  try {
                  var pageTracker = _gat._getTracker("UA-13251636-1");
                  pageTracker._trackPageview();
                  } catch(err) {}</script>
                  </body>
                  </html>
                  EOD;
                  echo "$theResults";


                  ?>

                  • 6. Re: My form does not work:-(
                    nmbnmb Level 2

                    In the email body, you need to append Field to the variable names. For example,

                     

                    find:

                    First Name: $firstname <br>

                     

                    change to:

                    First Name: $firstnameField <br>

                     

                    FYI: Your script is vunerable to email header injection. I personally use Forms To Go to generate secure mailer scripts. The unregistered version is free to use.

                    • 7. Re: My form does not work:-(
                      karina1717 Level 1

                      That worked! I got that PHP code from "tutvid" video tutorials. Usually his information is excellent and it worked when he was doing it simultaneously. Really odd...