cancel
Showing results for 
Search instead for 
Did you mean: 

PHP Contact Form

webcrawler2050
Member

Hey Guys,

 

I am having some trouble with this form. Can anyone assist: 

 

 <?php

// get posted data into local variables
$EmailFrom = "info@wearededicated.me.uk";
$EmailTo = "info@wearededicated.me.uk";
$Subject = "Contact";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Mobile = Trim(stripslashes($_POST['Mobile']));
$Fax = Trim(stripslashes($_POST['Fax']));
$comm = Trim(stripslashes($_POST['comm']));

// validation
$validationOK=true;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Mobile: ";
$Body .= $Mobile;
$Body .= "\n";
$Body .= "Fax: ";
$Body .= $Fax;
$Body .= "\n";
$Body .= "comm: ";
$Body .= $comm;
$Body .= "\n";

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

// redirect to success page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

1 ACCEPTED SOLUTION

Accepted Solutions

dave
Guru

not sure why it is not working to be honest.

 

However, you can download a pretty decent PHP form script from the following page, and it does work with BT's server.

 

http://www.freecontactform.com/free.php

View solution in original post

4 REPLIES 4

dave
Guru
Can you be a bit more specific about the trouble you are having with the form?

webcrawler2050
Member
It's simply not sending out the email..

dave
Guru

not sure why it is not working to be honest.

 

However, you can download a pretty decent PHP form script from the following page, and it does work with BT's server.

 

http://www.freecontactform.com/free.php

webcrawler2050
Member
I'd rather use my own script to be honest. I don't like these "free generators" can inject some security risks.