6 Replies Latest reply: Dec 15, 2009 2:28 PM by bregent RSS

    How to email form data in dreamweaver

    mawwwty

      Is there any SIMPLE tutorials that will allow me to email form data from my website to my email address

        • 1. Re: How to email form data in dreamweaver
          bregent MVP

          You will need a server side form processing script. You can try contacting your host to see if they have a script for use with your plan. Please search this forum or the web for 'form mail script' if you need more details.

          .

          • 2. Re: How to email form data in dreamweaver
            mawwwty Community Member

            I have a php script and edited it by changing my email address but when i tested the form it didnt send

            • 3. Re: How to email form data in dreamweaver
              Ken Binney-GnPIX3 Community Member

              If you have Linux or other *nix servers,I prefer NateMail script (free from Nate Baldwin
              at www.mindpalette.com)

               

              You add your recipient email address to the script, save it and upload to your server.

              You also make a form page using DW which sends its data to the mail script, which

              prepares amd sends the email

              • 4. Re: How to email form data in dreamweaver
                bregent MVP

                Then you will need to show us the php script and form you are using and explain exactly what happens when you submit the form.

                • 5. Re: How to email form data in dreamweaver
                  mawwwty Community Member
                  <?php
                  if(isset($_POST['email'])) {
                       
                       // EDIT THE 2 LINES BELOW AS REQUIRED
                       $email_to = "***********@aol.com";
                       $email_subject = "DVD Query";
                       
                       
                       function died($error) {
                            // your error code can go here
                            echo "We are very sorry, but there were error(s) found with the form your submitted. ";
                            echo "These errors appear below.<br /><br />";
                            echo $error."<br /><br />";
                            echo "Please go back and fix these errors.<br /><br />";
                            die();
                       }
                       
                       // validation expected data exists
                       if(!isset($_POST['Name']) ||
                            !isset($_POST['Surname']) ||
                            !isset($_POST['Age']) ||
                            !isset($_POST['Gender']) ||
                            !isset($_POST['Subject']) ||
                            !isset($_POST['Description'])) {
                            died('We are sorry, but there appears to be a problem with the form your submitted.');          
                       }
                       
                       $Name = $_POST['Name']; // required
                       $Surname = $_POST['Surname']; // required
                       $Age = $_POST['Age']; // required
                       $Gender = $_POST['Gender']; // not required
                       $Subject = $_POST['Subject']; // not required
                       $Description = $_POST['Description']; // required
                       
                       $string_exp = "^[a-z .'-]+$";
                    if(!eregi($string_exp,$Name)) {
                         $error_message .= 'The First Name you entered does not appear to be valid.<br />';
                    }
                    if(!eregi($string_exp,$Surname)) {
                         $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
                  
                  
                  
                       
                       $email_message .= "Name: ".clean_string($Name)."\n";
                       $email_message .= "Surname: ".clean_string($Surname)."\n";
                       $email_message .= "Age: ".clean_string($Age)."\n";
                       $email_message .= "Subject: ".clean_string($Subject)."\n";
                       $email_message .= "Description: ".clean_string($Description)."\n";
                       
                       
                  // create email headers
                  $headers = 'From: '.$email_from."\r\n".
                  'Reply-To: '.$email_from."\r\n" .
                  'X-Mailer: PHP/' . phpversion();
                  @mail($email_to, $email_subject, $email_message, $headers);  
                  ?>
                  
                  <!-- include your own success html here -->
                  
                  Thank you for contacting us. We will be in touch with you very soon.
                  
                  <?
                  }
                  ?>
                  
                  
                  Name:
                  Surname:
                  Age:
                  Gender:


                  Subject:
                  Description:

                  The form is above and i have attached my PHP.

                  • 6. Re: How to email form data in dreamweaver
                    bregent MVP

                    I would have made it easier if you posted the form html in code view, but it appears that your form field names do not match the names that the php script is expecting. Confirm you are using the correct field names and try again.