Jump to content

mail form is not sending


bryanptcs

Recommended Posts

I have a contact form and it used to work.  I think I might have changed versions of php but I am not sure what I had before.  It is now running 5.1.6, here is the php code for the form.  This is the error I am getting, it is from the last line of the PHP code: "Error: Please press back on your browser and try again."

 


<?php


$EmailTo = "bryanedwards05@gmail.com";



$contactsubject= Trim(stripslashes ($_POST['subject']));
$Name= Trim(stripslashes ($_POST['name']));
$HomeTel= Trim(stripslashes ($_POST['phone']));
$Email= Trim(stripslashes ($_POST['email']));
$Message= Trim(stripslashes ($_POST['message']));
$EmailFrom = $Email;
// validation
$validationOK=true;
if (Trim($Name)=="") $validationOK=false;
if (Trim($contactsubject)=="") $validationOK=false;
if (Trim($Email)=="") $validationOK=false;
if (Trim($Message)=="") $validationOK=false;
if (!$validationOK) {
  echo "The form was not properly sent, please press back on your browser and make sure all required feilds are entered and try again.  Thank you.";
  exit;
}

$Subject = "ChristKidz.com Contact Form " . $contactsubject;


$Body ="";
$Body .="Name: ";
$Body .=$Name;
$Body .="\n";
$Body .="Phone: ";
$Body .=$HomeTel;
$Body .="\n";
$Body .="Email: ";
$Body .=$Email;
$Body .="\n";
$Body .="\n";
$Body .="Message: ";
$Body .="\n";
$Body .=$Message;
$Body .="\n";


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


if ($success) {

    echo "The Following Message has succesfully been sent to the childrens ministry:<br><br>";

    echo "Name: $Name<br>";
echo "Phone: $HomeTel<br>";
echo "Email: $Email<br><br>";
echo "Subject: $Subject<br><br>";
echo "Message: $Message<br><br>";
    echo "Thank you for your questions or comments, we will reply to them as soon as possible.  Have a great day";

}
else {

echo "Error: Please press back on your browser and try again.";
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.