15 Replies Latest reply on Feb 26, 2015 10:03 AM by Nancy OShea

    Contact Page Form

    MK_male

      Hi all

      I am trying to have a basic contact form for my website with the following fields

       

      Name*

      Phone Number

      Email Address*

      Message*

       

      and then Email to my Email address once submitted can anyone help me sort one out please?

        • 1. Re: Contact Page Form
          Jon Fritz II Adobe Community Professional & MVP

          You'll need a server-side form processing script.

           

          What language you choose depends on your server.

           

          If you have PHP available, there are tons of free scripts available online that generally come with a pretty straight forward "how to" section. Just do a quick search for "Form to email php script" and you'll get a ton of options.

           

          There's nothing built into DW that can do it for you though.

          • 2. Re: Contact Page Form
            Nancy OShea Adobe Community Professional & MVP

            Below is the HTML5 form.  Contact your host and ask them if they have form-to-email scripts you can use.  Some do; some don't.

             

            <!doctype html>

            <html>

            <head>

            <meta charset="utf-8">

            <title>Sample HTML5 Form</title>

             

            <style>

             

            /**BEGIN FORM STYLES**/

            #form1 {

            font-size: 14px;

            width: 500px;

            margin: 0 45px; /**adjust margins as needed**/

            background: #FFF;

            border: 2px groove green;

            padding: 7px 14px 7px 14px;}

             

            fieldset {

            margin-bottom:5px;

            border-right:none;

            border-bottom:none;

            border-left:none;

            }

             

            legend {

            padding: 8px;

            border: 1px solid silver;

            background: #009900;

            font-weight: bold;

            color: #FFF;

            line-height: 1.5;

            margin-left: -45px;

            /**for IE6 only**/

            *margin-left:0;

            }

             

            /**wrap form lables and fields inside ordered lists for better web accessibility**/

            #form1 ol {

            list-style:none;

            margin:0;

            padding:0}

             

            #form1 li {

            padding:5px;

            margin: 0;

            clear: left;

            }

             

            #form1 label{

            display:inline-block;

            font-weight:bold:

            float:left;

            line-height: 23px; /**lines up labels with fields**/

            width:167px;

            font-size: 16px;

            color: #666;

            text-align:right;

            margin-right: 10px; /*space between labels, fields*/

            }

             

            #form1 input,

            #form1 textarea {

            width: 190px; /**same width on text fields**/

            padding: 5px;

            color: #666;

            border: 1px dotted #009900;

            font-family:Arial, Helvetica, sans-serif;

            font-size: 12px;

            }

             

            /**field background on focus**/

            input:focus,

            input:active,

            textarea:focus,

            textarea:active

            {background-color: #EBECDE; border: 1px solid;}

             

            #submit {

            background: #009900;

            font-size: 18px;

            color:#FFF;

            font-weight: bold;

            border: 2px outset #FFF}

             

            #submit:hover,

            #submit:focus,

            #submit:active {

            background: #006600;

            color: yellow;

            border: 2px inset #FFF}

             

            /**END FORM STYLES**/

            </style>

            </head>

            <body>

             

            <!--BEGIN HTML FORM, action="path to form-processing script on your server" -->

             

            <form id="form1" action="path/your-formtoemail-script.php" method="post" enctype="multipart/form-data" name="form1">

             

            <h3>HTML Contact Form</h3>

             

            <fieldset>

            <legend>Required Fields:</legend>

            <!--for trapping spam bots  -->

            <input name="config" type="hidden" value="0">

            <input type="text" id="nospam" style="display:none">

             

            <ol>

            <li>

            <label for="name">Name:</label>

            <input name="name" id="name" type="text" onClick="this.value='';" placehoolder="First and Last" required="required">

            </li>

            <li>

            <label for="email">E-mail:</label>

            <input name="email" type="email" id="email" placeholder="yourname@domain.com" onClick="this.value=''" required="required">

            </li>

            </ol>

            </fieldset>

            <fieldset>

            <legend>Optional Fields:</legend>

            <ol>

            <li>

            <label for="phone">Phone:</label>

            <input name="phone" id="phone" type="text" placeholder="123-456-7890">

            </li>

            <li>

            <label for="message">Message:</label>

            <textarea id="message" name="message" placeholder="250 characters max" onClick="this.value=''"></textarea>

            </li>

            <li>

            <label for="submit"> </label>

            <input type="submit" name="submit" id="submit" value="Submit">

            </li>

            </ol>

            </fieldset>

            </form>

            <p><!--END OF FORM --></p>

            </body>

            </html>

             

             

            Nancy O.

            1 person found this helpful
            • 3. Re: Contact Page Form
              MK_male Level 1

              hello Nancy

              thanks for the code I presume they go in two separate files?

              • 4. Re: Contact Page Form
                MK_male Level 1

                yes they support PHP too

                • 5. Re: Contact Page Form
                  Web Magi Level 4

                  I use Arclab for non-WordPress sites: Arclab® Web Form Builder | HTML Form Software for PC

                  1 person found this helpful
                  • 6. Re: Contact Page Form
                    MK_male Level 1

                    i think I am looking too much into this I cannot seem to get it to work

                    • 7. Re: Contact Page Form
                      MurraySummers Level 8

                      So, post a link to your page, please. That lets us see what you have done and diagnose what might be wrong.

                      • 8. Re: Contact Page Form
                        Rob Hecker2 Adobe Community Professional & MVP

                        OK. Take the following code and paste it into a new file. Name the file contact.php. Change the email address in the line

                        $to = 'your@emailaddress.com';  to your email address. Upload it to the server and run it from a browser.


                         

                         

                        <!doctype html>

                        <html>

                        <?php

                        //   In the line below that says: $to = 'your@emailaddress.com';

                        //   change the email address to your email address

                        if ($_POST){

                        if (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)){

                        $message="Please provide a correct email address";} else {

                          $name = strip_tags($_POST['name']);

                          $company_name = strip_tags($_POST['company_name']);

                          $telephone = strip_tags($_POST['telephone']);

                          $email = $_POST['email'];

                          $comments = strip_tags($_POST['comments']);

                          $to = 'your@emailaddress.com';

                          $subject = 'Contact form submitted.';

                          $body = $name. "\n" .$comments;

                          $headers = 'From: ' .$email;

                          if (mail($to, $subject, $body, $headers)) {

                          echo 'Thanks for contacting us. We\'ll be in touch soon!';

                          } else {

                          $message = 'Sorry an error occurred. Please try again later.';

                          }

                          }}

                        ?>

                        <head>

                        <meta charset="utf-8">

                        <title>Untitled Document</title>

                        </head>

                        <body>

                        <?php echo "<p style='color:red'>$message</p>"; ?>

                        <div class="contact_form">

                            <form id="contactform" action="contact.php" method="post">

                        <p>Name:<br/><input name="name" type="text" required /></p>

                        <p>Company Name: <br/><input name="company_name" type="text" required/></p>

                        <p>Telephone: <br/><input name="telephone" type="tel" required/></p>

                        <p>Email: <br/><input name="email" type="email" required/></p>

                        <p>Comments: <br/><textarea name="comments" required/>   </textarea></p>

                            <input type="submit" name="submit" value="Send!"/>

                         

                        </form>

                        </div>

                        </body>

                        </html>

                        1 person found this helpful
                        • 9. Re: Contact Page Form
                          MK_male Level 1

                          seem to think it maybe a hosting issue? heres my website address for the contact page still getting issues!

                          www.UltraFinish.co.uk/contactform.html

                           

                          soon as you click submit it doesnt work

                          • 10. Re: Contact Page Form
                            MK_male Level 1

                            right ruys found the problem, the package i am on dosnt support PHP, but does support HTML5,

                             

                            Nancy - for the HTML5 code you game me do i copy all that into one file,

                            • 11. Re: Contact Page Form
                              Rob Hecker2 Adobe Community Professional & MVP

                              The hosting package doesn't have anything to do with HTML5. It's the browsers people use to visit the website that must support HTML5.

                               

                              If the host doesn't support server side scripting with PHP or ASP.NET, then you cannot create a contact form. You can't do it.

                              • 12. Re: Contact Page Form
                                Jon Fritz II Adobe Community Professional & MVP

                                If your hosting company is charging you anything more than say $0/month, and they won't add PHP or ASP, or allow you to click a button to add it from the admin panel, it's time to move to a new company.

                                 

                                I've never come across a paid service that doesn't offer at least an optional PHP installation.

                                 

                                Are you sure it isn't something you can add from your hosting admin panel?

                                 

                                If you truly can't get php onto the server, maybe a service like Online Form Builder with Cloud Storage Database | Wufoo would work for you.

                                 

                                Don't use an all html contact form, they won't work for any viewer using browser based email and they leave your email address open for the entire internet to start sending you spam.

                                1 person found this helpful
                                • 13. Re: Contact Page Form
                                  Nancy OShea Adobe Community Professional & MVP

                                  the package i am on doesn't support PHP,

                                  Then you can't use PHP scripts.

                                  Does your hosting plan support Perl or ASP?

                                  If none of the above, find better hosting.

                                   

                                   

                                  Nancy O.

                                  • 14. Re: Contact Page Form
                                    MK_male Level 1

                                    Thanks Nancy, I am currently with 1and1 internet which i thought were pretty good turns out there standard package hardly does anything and just for PHP they double in price for packages, anyone got any suggestions on web hosts?, I have heard good reviews about "Just Host".

                                    • 15. Re: Contact Page Form
                                      Nancy OShea Adobe Community Professional & MVP

                                      I am currently with 1and1 internet which i thought were pretty good turns out there standard package hardly does anything and just for PHP they double in price...

                                      You must be on a Windows Server (ASP or ASP.net).  Linux/Apache servers come standard with PHP. 

                                       

                                       

                                      Nancy O.