How to create a simple lead form?

Discussion in 'HTML & Website Design' started by strawberrybob, Jan 9, 2015.

  1. #1
    Hi,
    Can anyone please give me guide on creating a lead form for a landing page? Say there will be three fields, Name, Phone and Email. If someone fill in the form then I will receive their details in my email. How can I do that?
     
    strawberrybob, Jan 9, 2015 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,812
    Likes Received:
    4,535
    Best Answers:
    123
    Trophy Points:
    665
    #2
    That's a really simple contact form - use google, find and work through a few examples so that you can see a few different ways of working it.
     
    sarahk, Jan 9, 2015 IP
  3. CarpCharacin

    CarpCharacin Active Member

    Messages:
    325
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Here is a link to a good one: http://www.foxyform.com/
     
    CarpCharacin, Jan 9, 2015 IP
  4. strawberrybob

    strawberrybob Greenhorn

    Messages:
    69
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    8
    #4
    Thanks CarpCharacin & Sarahk

    I really like foxyform but they use their brand in the form :( How can I hide that?
     
    strawberrybob, Jan 12, 2015 IP
  5. CarpCharacin

    CarpCharacin Active Member

    Messages:
    325
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    90
    #5
    sorry i do not know.
     
    CarpCharacin, Jan 12, 2015 IP
  6. CodeShop

    CodeShop Active Member

    Messages:
    137
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #6
    Here is the php code along the html form. Create a php file and copy/paste this code in file and execute to make sure everything works.

    <?php
    if(isset($_POST['submit'])){
    $to ="email@example.com";// this is your Email address
    $from = $_POST['email'];// this is the sender's Email address
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $subject ="Form submission";
    $subject2 ="Copy of your form submission";
    $message = $first_name ." ". $last_name ." wrote the following:"."\n\n". $_POST['message'];
    $message2 ="Here is a copy of your message ". $first_name ."\n\n". $_POST['message'];
    
    $headers ="From:". $from;
    $headers2 ="From:". $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2);// sends a copy of the message to the sender
    echo "Mail Sent. Thank you ". $first_name .", we will contact you shortly.";// You can also use header('Location: thank_you.php'); to redirect to another page.}?>
    
    <!DOCTYPE html><head><title>Form submission</title></head><body>
    
    <form action="" method="post">
    First Name: <inputtype="text"name="first_name"><br>
    Last Name: <inputtype="text"name="last_name"><br>
    Email: <inputtype="text"name="email"><br>
    Message:<br><textarearows="5"name="message"cols="30"></textarea><br><inputtype="submit"name="submit"value="Submit"></form>
    
    </body></html>
    PHP:
     
    Last edited by a moderator: Jan 13, 2015
    CodeShop, Jan 12, 2015 IP
  7. sarahk

    sarahk iTamer Staff

    Messages:
    28,812
    Likes Received:
    4,535
    Best Answers:
    123
    Trophy Points:
    665
    #7
    @CodeShop - that form can be used to send spam from your servers. It's really unsafe.
     
    sarahk, Jan 13, 2015 IP
  8. CodeShop

    CodeShop Active Member

    Messages:
    137
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #8
    https://www.google.com/recaptcha/intro/index.html

    Add rCaptcha to this form and that's it.
     
    CodeShop, Jan 14, 2015 IP
  9. strawberrybob

    strawberrybob Greenhorn

    Messages:
    69
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    8
    #9
    @CodeShop thanks a lot! I am not a coder but I can understand basic things. In your code I don't think there is any validation check for form fields. Can you please add validation check and captha integration as well within this code to avoid spam? My website pages are not php based. Pages are on HTML. Can you please rewrite the code and give me updated one? Thanks in advance!
     
    strawberrybob, Jan 18, 2015 IP
  10. strawberrybob

    strawberrybob Greenhorn

    Messages:
    69
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    8
    #10
    From your servers? What do you mean? Can you please explain.
     
    strawberrybob, Jan 18, 2015 IP
  11. sarahk

    sarahk iTamer Staff

    Messages:
    28,812
    Likes Received:
    4,535
    Best Answers:
    123
    Trophy Points:
    665
    #11
    You know how you can send a copy to the person filling out the form?
    Well, spammers do that and put spam in the message and put their email address as the person they really want the spam sent to.
    Next thing you know you are getting all this stuff for Russian florists (I kid you not) but what they're really doing is sending the spam to hundreds of other people via your site. Your site then gets the bad reputation.
     
    sarahk, Jan 18, 2015 IP