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

Home Forums Back End PHP contact form fields… what am I doing wrong?

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

    I’m making a contact form using PHP, I’ve got the look of the form done and I’m very happy with the look – but the actual email bit is a bit challenging. I’m using the code from Chris’ contact form, and the script does send emails… and I receive them but the emails are completely blank apart from the ‘name: email: message:’ stuff and the subject. What am I doing wrong? Here is the code I am using:



    $EmailFrom = "[email protected]";
    $EmailTo = "[email protected]";
    $Subject = "Contact Form Submission";

    $fullName = Trim(stripslashes($_POST));
    $emailAddress = Trim(stripslashes($_POST));
    $message = Trim(stripslashes($_POST));

    $Body = "";
    $Body .= "Name: ";
    $Body .= $fullName;
    $Body .= "n";
    $Body .= "Email: ";
    $Body .= $emailAddress;
    $Body .= "n";
    $Body .= "Message: ";
    $Body .= $message;
    $Body .= "n";

    $success = mail($EmailTo, $Subject, $Body, "From: $emailAddress");

    I really have no idea how to code in PHP and I’m sure this is a really dumb question… but please help!




    First of all looking at your code you will need to fix what you are putting in the $_POST. This is case sensitive and needs to match what you are sending from your form.

    For Example:

    $fullName = Trim(stripslashes($_POST));
    $emailAddress = Trim(stripslashes($_POST));
    $message = Trim(stripslashes($_POST));

    This should work for you now. You should also look into validating your Data.


    Alex, I also had problem with blank email messages, and tried to find a program to create and embed valid and personalized php forms. Thanks God for a year already there hasn’t been any serious error.

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