Grow your CSS skills. Land your dream job.

[Solved] Contact Form Struggles

  • # January 29, 2010 at 4:17 pm

    I’m having a hard time wrestling this PHP contact form code. I have the form completely styled (http://fiveeightfive.com/contact/) and ready to go but I can’t seem to get the mail functionality to… well, function. Here’s the PHP code for the form:

    Code:
    < ?php
    if(isset($_POST['submit'])) {

    $to = "*my e-mail address is here*";
    $subject = "fiveeightfive contact form submission";
    $name_field = $_POST['firstname'] ['lastname'];
    $email_field = $_POST['email'];
    $message = $_POST['msg'];

    $body = "From: $name_fieldn E-Mail: $email_fieldn Message:n $message";

    echo "Data has been submitted to $to!";
    mail($to, $subject, $body);

    } else {

    echo "Error!";

    }
    ?>

    # January 29, 2010 at 4:33 pm

    Hmm….this line looks to me like it would throw an error

    Code:
    $name_field = $_POST[‘firstname’] [‘lastname’];

    Should it not be

    Code:
    $name_field = $_POST[‘firstname’] .” “. $_POST[‘lastname’];

    ?

    # January 29, 2010 at 5:03 pm

    I think you’re right but it still gives me an error.

    # January 29, 2010 at 5:55 pm

    Well what is the error it gives you?

    # January 29, 2010 at 6:10 pm

    Hey, I’ve got it all figured out now. I threw out my code and replaced it with the Simple Contact Form form CSS-Tricks. Thanks!

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".