Results 1 to 10 of 10

Thread: Newbie needs help with template please

  1. #1
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Newbie needs help with template please

    Hi

    I just downloaded a css template which I want to have a play around with.

    http://www.templatemo.com/templates/...mo_283_tomato/

    On the contact page, there is a Contact Form.

    However, I can't find where to enter my email details to receive the form contents. Ive searched all the css and js pages for "email" or "@" and cannot find anything relevant.

    Would anyone know where I could start please.

    BTW the template does look fantastic, so thanks to everyone out there who is contributing their work for the benefit of us all.

    Paul

    Added: I noticed that in IE8 the "contact" text at top right keeps dropping. I can't see anything wrong in the code and it looks fine in FF and Chrome - any ideas on that too?

    .
    Last edited by paul-uk; 05-02-2011 at 04:22 PM. Reason: added the bottom bit

  2. #2
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ive managed to dig out the source code for the Contact Form;

    Code:
            <div class="panel" id="contactus">
                <div class="col_w540">
                    <div id="contact_form">
                    <h4>Quick Contact</h4>
                    
                    <form method="post" name="contact" action="#">
     
                        <label for="author">Name:</label> <input type="text" id="author" name="author" class="required input_field" />
                        <div class="cleaner_h10"></div>
                        <label for="email">Email:</label> <input type="text" id="email" name="email" class="validate-email required input_field" />
                        <div class="cleaner_h10"></div>
                        
                        <label for="url">Phone:</label> <input type="text" name="url" id="url" class="input_field" />
                        <div class="cleaner_h10"></div>
                    
                        <label for="text">Message:</label> <textarea id="text" name="text" rows="0" cols="0" class="required"></textarea>
                        <div class="cleaner_h10"></div>
                        
                        <input type="submit" class="submit_button float_l" name="submit" id="submit" value="Send" />
                        <input type="reset" class="submit_button float_r" name="reset" id="reset" value="Reset" />
                    </form>
                    
                    </div>
                </div>
    What I dont seem to have (can't find) is any type of php coding to get the thing working - Im guessing that would go into
    Code:
    action="#"
    .

    Anyone able to show me what php code I would use please?

    I could also really do with being able to add in the form;

    "reason for contact" and a drop down choice of "a" "b" or "c".

    Any ideas please?

    Thanks

  3. #3
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    There are lots of tutorials online - here's one to get you started: http://www.kirupa.com/web/php_contact_form.htm

    You can also Google "contact form tutorial" for more.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  4. #4
    Join Date
    May 2011
    Location
    SFBA, CA, USA
    Posts
    94
    Thanks
    6
    Thanked 7 Times in 7 Posts

    Default

    Hi paul-uk,

    Try putting this into a separate .php doc and pointing to it in your action="#"


    Code:
    <?php
    if(isset($_POST['email'])) {
         
        // EDIT THE 2 LINES BELOW AS REQUIRED
        $email_to = "you@yourdomain.com";
        $email_subject = "Your email subject line";
         
         
        function died($error) {
            // your error code can go here
            echo "We are very sorry, but there were error(s) found with the form you 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['first_name']) ||
            !isset($_POST['last_name']) ||
            !isset($_POST['email']) ||
            !isset($_POST['telephone']) ||
            !isset($_POST['comments'])) {
            died('We are sorry, but there appears to be a problem with the form you submitted.');      
        }
         
        $first_name = $_POST['first_name']; // required
        $last_name = $_POST['last_name']; // required
        $email_from = $_POST['email']; // required
        $telephone = $_POST['telephone']; // not required
        $comments = $_POST['comments']; // required
         
        $error_message = "";
        $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
      if(!preg_match($email_exp,$email_from)) {
        $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
      }
        $string_exp = "/^[A-Za-z .'-]+$/";
      if(!preg_match($string_exp,$first_name)) {
        $error_message .= 'The First Name you entered does not appear to be valid.<br />';
      }
      if(!preg_match($string_exp,$last_name)) {
        $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
      }
      if(strlen($comments) < 2) {
        $error_message .= 'The Comments you entered do not appear to be valid.<br />';
      }
      if(strlen($error_message) > 0) {
        died($error_message);
      }
        $email_message = "Form details below.\n\n";
         
        function clean_string($string) {
          $bad = array("content-type","bcc:","to:","cc:","href");
          return str_replace($bad,"",$string);
        }
         
        $email_message .= "First Name: ".clean_string($first_name)."\n";
        $email_message .= "Last Name: ".clean_string($last_name)."\n";
        $email_message .= "Email: ".clean_string($email_from)."\n";
        $email_message .= "Telephone: ".clean_string($telephone)."\n";
        $email_message .= "Comments: ".clean_string($comments)."\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.
     
    <?php
    }
    ?>
    cheers,
    dbc

  5. #5
    Join Date
    May 2011
    Location
    SFBA, CA, USA
    Posts
    94
    Thanks
    6
    Thanked 7 Times in 7 Posts

    Default

    Oh, and try this to add dropdown selections within your form:

    Code:
    <select name="dropdownTitle">
       <option value="" selected>Select One</option>
       <option value="choice1">Choice 1</option>
       <option value="choice2">Choice 2</option>
       <option value="choice3">Choice 3</option>
       <option value="choice4">Choice 4</option>
    </select>
    dbc

  6. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Here's the direct link to the website that provided the code posted by deathbycheese: http://www.freecontactform.com/email_form.php

    The additional information in their tutorial may help fill in any gaps.

    deathbycheese - Please can you try to post links to the origin of the code if you are reposting from other websites as it avoids quibbles from other webmasters and helps everyone here feel safer about providing code to help others
    I'm sure you can appreciate that it can be very disheartening to see your own work popup on other websites without any indication of where its come from and its only fair when somebody else has but in the time and effort creating the resource.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  7. #7
    Join Date
    May 2011
    Location
    SFBA, CA, USA
    Posts
    94
    Thanks
    6
    Thanked 7 Times in 7 Posts

    Default

    @Beverleyh.
    I did NOT get the code from the location you indicate. Please do not assume.
    It was a small part of a package I got from simplemodal. I do not claim to have written the code myself and am not interested in exploiting others' endeavors.
    Thanks.
    dbc

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Regardless Beverley is right: posting a link to the source helps for two reasons: 1. it deals with any possible copyright issues, and 2. it helps us to see if there is any documentation etc. Please remember that while we are familiar with the languages and general web design techniques involved, we often have never even heard of a certain script before, so in order to help at all with it, having a link to any sites with more information about it is helpful.
    Both your link and hers are helpful. Do the tutorials in the link to the (original?) source answer your questions?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Sorry for the confusion - I recognised the code for a tutorial I myself had followed in the past and thought it would be helpful to provide the link. I'm glad you clarified the origin of your code deathbycheese and hope you can contribute more to the forums in future.

    Best wishes
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  10. #10
    Join Date
    May 2011
    Location
    SFBA, CA, USA
    Posts
    94
    Thanks
    6
    Thanked 7 Times in 7 Posts

    Default

    Thanks for the kind words, Beverleyh. i will be clearer with my posts/sources.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •