Treehouse: Grow your CSS skills. Land your dream job.

need code for this EMAIL FORM

  • # April 18, 2011 at 1:20 pm

    I need a php code for my email form I’ve found some but I don’t know how to include it. Can you guys help me!! Please! Thank you!




    here’s the website

    # April 19, 2011 at 9:19 am


    Not wishing to sound rude but I think you may be out of your depth here.

    A couple of things
    1, The form action needs to point to the PHP page that you want to send the email. At the moment it’s pointing to an ASP page.
    2, The form method should be post really.

    To give you some idea the input name fields will become the variable names in your PHP.
    So in PHP the first name variable will be


    Now you have your variables you just need to attach them to the email

    $to = "";
    $subject = "Contact Form";
    $body = "First name: " . $_POST;
    mail($to, $subject, $body);
    # April 24, 2011 at 11:28 am

    thanks man!

    # April 24, 2011 at 1:55 pm

    Replace your “p” tags with “label” tags aswell.

    Also suggest when collecting the form data with PHP run it though htmlentities()for security.

    $f_nombr = htmlentities($_POST);

    # April 25, 2011 at 2:05 pm

    Thank you
    Do you have any html email form tutorial that you can refer me to?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.