Get help. Give help. A Web Design and Development Community.

[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 ( 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:

    < ?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

    This reply has been reported for inappropriate content.

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

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

    Should it not be

    $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

    This reply has been reported for inappropriate content.

    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.

We have a pretty good* newsletter.