ModalBox电子邮件将php变量传递给sms发件人
好的,我使用ModalBox在我的网站上创建了一个电子邮件表单。但是,我需要ModalBox来发送电子邮件,而不是发送给我,而是发送给添加汽车的用户(这是一个汽车销售网站),因此我需要将$email变量传递给sendmessage.php 这就是我到目前为止所做的:ModalBox电子邮件将php变量传递给sms发件人,php,jquery,email,variables,post,Php,Jquery,Email,Variables,Post,好的,我使用ModalBox在我的网站上创建了一个电子邮件表单。但是,我需要ModalBox来发送电子邮件,而不是发送给我,而是发送给添加汽车的用户(这是一个汽车销售网站),因此我需要将$email变量传递给sendmessage.php 这就是我到目前为止所做的: $(document).ready(function() { $(".modalbox").fancybox(); $("#contact").submit(function() { return false; })
$(document).ready(function() {
$(".modalbox").fancybox();
$("#contact").submit(function() { return false; });
$("#send").on("click", function(){
setTimeout("$.fancybox.close()", 10);
var emailval = $("#email").val();
var msgval = $("#msg").val();
var msglen = msgval.length;
var mailvalid = validateEmail(emailval);
if(mailvalid == false) {
$("#email").addClass("error");
}
else if(mailvalid == true){
$("#email").removeClass("error");
}
if(msglen < 4) {
$("#msg").addClass("error");
}
else if(msglen >= 4){
$("#msg").removeClass("error");
}
if(mailvalid == true && msglen >= 4) {
// if both validate we attempt to send the e-mail
// first we hide the submit btn so the user doesnt click twice
$("#send").replaceWith("<em>Se trimite...</em>");
$.ajax({
type: 'POST',
url: 'http://automoka.ro/sendmessage.php',
data: $("#contact").serialize(),
success: function(data) {
if(data == "true") {
$("#contact").fadeOut("fast", function(){
$(this).before("<p><strong>Mesajul a fost trimis!</strong></p>");
setTimeout("$.fancybox.close()", 10);
$_POST['contact'] = $email;
});
}
}
});
}
});
});
我做错了什么?请帮忙……提前谢谢
编辑:
没关系,我想出来了!。。。我添加了另一个隐藏在modalbox中的文本区域…并使用post将其发送到sendmessage.php。
$email = $_POST['contact'];
$sendto = $email;
$usermail = $_POST['email'];
$content = nl2br($_POST['msg']);
if(@mail($sendto, $subject, $msg, $headers)) {
echo "true";
} else {
echo "false";
}