我有一个邮件脚本,邮件表单被发送到mysql数据库。有没有办法我可以将表格数据的副本发送到电子邮件,甚至只是一个警报类型的消息,如'表单已提交'我尝试添加另一个邮件标题但它似乎不起作用。
PHP,
<?php
include('include/function.php');
if (isset($_POST['Add'])){
$client_id=addslashes( htmlspecialchars($_POST['client_id']));
$proj_year=$_POST['year'];
$feedback=addslashes( htmlspecialchars($_POST['feedback']));
$proj_desc=addslashes( htmlspecialchars($_POST['proj_desc']));
$rating=$_POST['rating'];
$companyname=addslashes( htmlspecialchars($_POST['companyname']));
if($_FILES['photo']['name']) {
$photofile = $base_dir . date(His).basename($_FILES['photo']['name']);
if (move_uploaded_file($_FILES['photo']['tmp_name'], $photofile)) {
$photoname=date(His).$_FILES['photo']['name'];
}
}
$sql="INSERT INTO review VALUES('','$client_id','$rating','$proj_desc','$companyname','$feedback',0)";
if($client_id && $rating && $proj_desc && $feedback)
$rset=mysql_query($sql);
if($rset && mysql_affected_rows()>0)
{
$to =$useremail;
$subject = 'New Testimonial Added';
$message = "Testimonial Details". "\r\n" ;
$message.='Client Name :'.stripslashes($client_id). "\r\n" ;
$message.='Testimonial :' .stripslashes($feedback). "\r\n" ;
$headers = 'From:' .$to . "\r\n" ;
mail($to, $subject, $message, $headers);
$successmsg="Testimonial has been added Successfully.";
}
else if(mysql_errno()==1062)
{
$errmsg="Duplicate data.";
}
else
{
$errmsg="Adding Testimonial failed.";
}
}
?>
表单类型,
<form name="addform" action="testimonial.php" id="myform" enctype="multipart/form-data" method="post" onSubmit="javascript:return validatefrm();>
答案 0 :(得分:0)
phps mail函数中的to参数接受以逗号分隔的多个电子邮件:
mail($to . ',your@email.com', $subject, $message, $headers);