Best choice for form?

Discussion in 'PHP' started by j_eclipse, Dec 28, 2008.

  1. #1
    I'm wanting to put a contact form on my website. I want it to have a place for visitors to input name, email & description. I did some looking online and am now more confused than before. I was going to do it in dreamweaver in html, but I read that that type only works if the visitor has a mail client setup. I want something that every visitor can use, so I always get the response. I read that php is good for this? How hard is it to learn how to make this, or is there somewhere I can download one already done? Thank you for any help.

    Ps. Does anyone have any suggested books to read to learn php, I have no background in programming, not even html.
     
    j_eclipse, Dec 28, 2008 IP
  2. pepeRu

    pepeRu Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    it's actually quite easy, you only need to set up the form, then use the php mail function to send the feedback to your e-mail inbox..

    in the contact form page add this:
    
    <form action="processing_page.php" methos="post">
    <input type="text" name="visitor_name" /><br />
    <input type="text" name="visitor_email" /><br />
    <textarea name="description" cols="40" rows="6"></textarea><br />
    <input type="submit" value="Send Feedback" />
    </form>
    
    HTML:
    and in the processing page add this code:
    
    $visitor_name = $_POST['visitor_name'];
    $visitor_email = $_POST['visitor_email'];
    $description = $_POST['description'];
    $message_body = "Message From $visitoe_name, ($visitor_email)\n$description";
    mail("youremail@yourdomain.tld", "Feedback from my site", $message_body);
    
    PHP:
    Please notice this is just an example, you should change its content to suit your needs, and also don't forget to validate user input for security and to get the best of your users...
     
    pepeRu, Dec 29, 2008 IP
  3. j_eclipse

    j_eclipse Member

    Messages:
    76
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    48
    #3
    this looks very easy, I'm guessing I just copy and past it in. Thank you for your help I will try this today. But I have one more question, what is the processing page, & what is validate user input. Sorry I guess that is two questions. So this will work for all visitors, they will be able to hit submit and i'll get it every time? Now we are up to three questions i'll stop now.
    Again thank you for all the help.
     
    j_eclipse, Dec 29, 2008 IP