Hi,
I'm having a problem with a PHP contact form on my website. About 10% of the time, once people click on the submit button, they get an error message, but the actual form is sent.
Here is the contact.php file...
<?php
include("globals.php");
$result = mysql_query("INSERT INTO contacts SET firstname='$firstname',lastname='$lastname',email='$email',add1='$add1',add2='$add2',city='$city',state='$state',zip='$zip',country='$country',phone='$phone',fax='$fax',interest1='$interest1',interest2='$interest2',howdidyouhear='$howdidyouhear',comments='".mysql_escape_string($comments)."',date=NOW()");
$message = "name: ".$firstname." ".$lastname."\n";
/
$message .= "add1: ".$add1."\n";
$message .= "add2: ".$add2."\n";
$message .= "city: ".$city."\n";
$message .= "state: ".$state."\n";
$message .= "zip: ".$zip."\n";
/
$message .= "country: ".$country."\n";
$message .= "phone: ".$phone."\n";
$message .= "fax: ".$fax."\n";
if ($interest1 == ""){
$interest1 = "no";
}
if ($interest2 == ""){
$interest2 = "no";
}
$message .= "interest in chinlone: ".$interest1."\n";
$message .= "interest in Mystic Ball: ".$interest2."\n";
$message .= "how did you hear: ".$howdidyouhear."\n";
$message .= "comments: ".stripslashes($comments);
$subject = "mystic ball contact form";
$header = "From: ".$email;
$to = "xxxx@xxxx.com,xxxx@xxxx.com";
if (mail ($to,$subject,$message,$header)){
header("Location: http://www.xxxx.com/contact_thanks.html");
} else {
echo "There was a problem with your submission. Please use your browser's Back button and try again.";
}
?>
Here is the globals.php file:
<?php
// keep this above web root = out of webspace - sensitive info
$db = mysql_connect("mysql7.opentransfer.com","xxxxx_xxxxx","ch199");
mysql_select_db("xxxxx_xxxxx",$db);
?>
(i've replaced senstive info with "xxxx" above.
Many thanks,
Matthew