Give help. Get help.

  • # September 1, 2009 at 2:08 pm

    I’m using the Nice & Simple Contact form and it works perfectly but I need some help with something else.

    How do I make an entry field required to be filled out before submission? You know, where the user gets an error message saying, "Please fill out your name & email."

    The PHP is exactly what Chris gave us other than edits to the To and From emails. If anyone could help, I’d greatly appreciate it!! I’m only familiar with editing PHP and not creating it.

    # September 1, 2009 at 4:29 pm

    I would do – personally and if statement.

    if($requiredfield) {

    //it is true – form submitted

    } else {

    //it is false form re-displayed with a message at the top like “fill it in properly” :)


    If you know PHP a little, that will make sense, if not then you might need to give us some code lol

    # September 1, 2009 at 4:48 pm

    Thanks Rob!

    Well, I guess I don’t know as much as I thought I did because I’m a little confused.

    Here’s my PHP

    < ?php $EmailFrom = "TESTING"; $EmailTo = ""; $Subject = "Mine Shaft Contact Form"; $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (!$validationOK) { print "“;

    // prepare email body text
    $Body = “”;
    $Body .= “Name: “;
    $Body .= $Name;
    $Body .= “n”;
    $Body .= “Email: “;
    $Body .= $Email;
    $Body .= “n”;
    $Body .= “Message: “;
    $Body .= $Message;
    $Body .= “n”;

    // send email
    $success = mail($EmailTo, $Subject, $Body, “From: < $EmailFrom>“);

    // redirect to success page
    if ($success){
    print ““;
    print ““;


    And here is the form in my HTML


    We would love to hear your thoughts or comments.
    Please feel free to send a message below.

    # September 2, 2009 at 12:08 pm

    Yeah I’d love to see it. I don’t really care how it’s done as long as it works.

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

You must be logged in to reply to this topic.