The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Simple Contact form

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #36750

    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:

    $EmailFrom = "[email protected]";
    $EmailTo = "[email protected]";
    $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!


    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.


    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?


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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.