• # February 20, 2012 at 11:53 am

    Hi All,

    I downloaded Chris’s simple contact form, and, since I know pretty much nothing about PHP, I was hoping to get some help..

    Below is my markup:

    And this is the PHP that I modified (I was hoping that’s what I had to do) to match my markup:

    < ?php

    $EmailFrom = "";
    $EmailTo = "";
    $Subject = "Nice & Simple Contact Form by CSS-Tricks";
    $Name = Trim(stripslashes($_POST));
    $Email = Trim(stripslashes($_POST));
    $Phone = Trim(stripslashes($_POST));
    $Comments = Trim(stripslashes($_POST));

    // validation
    if (!$validationOK) {
    print "";

    // prepare email body text
    $Body = "";
    $Body .= "name: ";
    $Body .= $name;
    $Body .= "n";
    $Body .= "email: ";
    $Body .= $email;
    $Body .= "n";
    $Body .= "phone: ";
    $Body .= $phone;
    $Body .= "n";
    $Body .= "comments: ";
    $Body .= $comments;
    $Body .= "n";

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

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

    My issues are:

    1. I receive the email, but the content is empty
    2. How do I modify the From field so that it would show actual email it came from instead of static email I set..
    3. I would like to get rid of the re-direct page as I’m using this form on the footer of a website..

    Thanks a bunch in advance and sorry for very basic question!

    # February 20, 2012 at 1:44 pm

    I’m having the same issue with an empty email.. I get the template printed, but the user input is not printed in the email.

    # February 22, 2012 at 3:50 am

    This reply has been reported for inappropriate content.

    Think about what you’re doing.

    $Email and $email are not the same. PHP variables are case sensitive.

    3) Remove the print which redirects to contactthanks.php

    # September 24, 2012 at 11:09 am

    Hi, I’m having the same problem with an empty email. I removed ‘print’ which just made the whole thing hang.

    Any advice to get this working?

    # September 24, 2012 at 11:57 pm

    This reply has been reported for inappropriate content.

    $variable and $Variable ARE NOT the same.

    tip: if you’re not getting a bunch of errors like Notice: Undefined variable: name... when you run your original code, then you need to turn on error reporting. It will be a great help with troubleshooting. Turn on error reporting in your php.ini file, or you can do it at the top of your script by using

    error_reporting( -1 );

    # September 25, 2012 at 1:16 am

    This is a really good contact form if you don’t know what you’re doing.

    # September 25, 2012 at 1:31 am

    This reply has been reported for inappropriate content.

    I’m thinking I’ll do a quick upgrade for Chris’ form…

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

You must be logged in to reply to this topic.