Grow your CSS skills. Land your dream job.

Simple Contact Form Dropdown Menu Help

  • # September 11, 2012 at 12:09 am

    I am trying to get a simple contact form to work so I get an email when the form is submitted. It works great, by the way. However, I can’t get it to work with my dropdown menu. Everything else works, so I am not sure why the dropdown doesn’t work. Here is the code:
    (pretend I put the rest of the form code before and after the dropdown code)

    and the php:

    < ?php

    $EmailFrom = Trim(stripslashes($_POST)); ;
    $EmailTo = "titanvex@titanvex.com";
    $Subject = "Incoming Inquiry from titanvex.com";
    $FirstName = Trim(stripslashes($_POST));
    $State = Trim(stripslashes($_POST));
    $Email = Trim(stripslashes($_POST));
    $Message = Trim(stripslashes($_POST));

    // validation
    $validationOK=true;
    if (!$validationOK) {
    print "";
    exit;
    }

    // prepare email body text
    $Body = "";
    $Body .= "Full Name: ";
    $Body .= $FirstName;
    $Body .= "n";
    $Body .= "Email: ";
    $Body .= $Email;
    $Body .= "n";
    $Body .= "Project Type: ";
    $Body .= $State;
    $Body .= "n";
    $Body .= "Message: ";
    $Body .= $Message;
    $Body .= "n";

    // send email


    // redirect to success page
    if (mail($EmailTo, $Subject, $Body, "From: < $EmailFrom>")){
    print "";
    }
    else{
    print "";
    }
    ?>

    Any help would be greatly appreciated on this problem. When I get the email, everything is filled in, except for the part where I am trying to get 'State'. Thank you very much in advanced!

    # September 11, 2012 at 12:28 am

    There is a stray ‘code’ tag in the select that could be slopping it up , also, you will need to make sure “Trim” is not capitalized…it needs to be all lowercase.

    But the actual issue is that you are not setting a value in the options…you should have something like this:

    http://jsfiddle.net/4DR6b/

    # September 11, 2012 at 4:17 am

    Trim will work capitalised or not, but kgscott is on the money, should be kept as standard lower case.

    # September 11, 2012 at 10:00 am

    Perfect. Works great. Thank you very much!

    # September 11, 2012 at 3:42 pm

    @andy_unleash yes, trim will work capitalized, but for convention sake (and mostly my sanity) it has to be all lower case! hahaha.

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".