我正在用 php 创建一个联系表单。当我填写所有内容并按提交时,它不会向特定的电子邮件地址发送任何消息。它显示了几个错误消息。
错误信息:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect
to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.91
/maaks/www/hotel/eng/resellers.php on line 93
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the
server could not be established in /homez.91/maaks/www/hotel/eng/resellers.php on line
93
etc.....
php代码:
<?php
if(isset($_POST['Send']) && $_POST['Send'] == "Submit")
{
$fname = mysql_real_escape_string($_POST['fname']);
$email = mysql_real_escape_string($_POST['email']);
$conum = mysql_real_escape_string($_POST['conum']);
$country = mysql_real_escape_string($_POST['country']);
$find = mysql_real_escape_string($_POST['find']);
$msg = mysql_real_escape_string($_POST['msg']);
$err = array();
if(isset($fname) & isset($email) & isset($conum) & isset($country) & isset($find) &
isset($msg))
{
if(empty($fname) & empty($email) & empty($conum) & empty($country) & empty($find) &
empty($msg))
{
$err[] = "All field require";
}
else
{
if(empty($fname))
$err[] = "Your first name require";
}
}
else
{
if(!empty($err))
{
foreach($err as $er)
{
echo "<font color=red>$er</font><br/>";
}
}
else
{
$to = "creativeart09@yahoo.com";
$subject = "Message from Customer";
$message = "$msg";
$from = "$email";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
if(mail())
{
echo "<script>";
header("Refresh: 0; url=Thankyou.html");
echo "</script>";
}
else
{
echo "Something is wrong" . mysql_error();
}
}
}
}
?>
我的代码有什么问题?