我正在建立一个网站,目前,我需要在其中使用联系我们表格。我是PHP的新手,但我不知道我需要什么来使我的表单工作。我问我的朋友,他说我需要一个脚本,从表单中获取信息并将其发送到定义的电子邮件地址。这是在PHP中完成的。我该怎么做呢?这是我现在的表格的代码:
<div class="scroll-to-top" data-offset-top="200" data-spy="affix"></div>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script language="JavaScript" type="text/javascript">
function callmailfun() {
var str = $('#frmcal').serialize();
// ajax to send mail
// not yet implemented serverside. Will throw an error
// serialize to prevent redirect
$.ajax({
type: "POST", url: "req_mail.php", data: str, success: function (msg) {
if (msg == '1') {
result = '<div class="notification_ok">Thank you for your interest <br />we will get back to you at the earliest.</div>';
$("#reset-form").trigger("click");
} else {
result = '<div class="notification_error">Your data could not be received. Try again later</div>';
}
// open the alert box
$('#note').html(result);
openiframe();
}
}); return false;
}
$(document).ready(function (e) {
// set the button to submit mail for the contact form
$("#frmcal").submit(function () {
validate = chk1();
if (validate) {
var str = $(this).serialize();
//prevent reloading of webpage
$.ajax({
type: "POST", url: "req_mail.php",
data: str, success: function (msg) {
alert(msg);
if (msg == '1') {
result = '<div class="notification_ok">Thank you for your interest we will get back to you at the earliest.</div>';
$("#reset-form").trigger("click");
} else {
result = '<div class="notification_error">Your data could not be received. Try again later</div>';
}
// open the alert box
$('#note').html(result);
openiframe();
}
});
} return false;
});
}); function CheckNumericKeyInfo($char, $mozChar) { if ($mozChar != null) { if (($mozChar >= 48 && $mozChar <= 57) || $mozChar == 0 || $mozChar == 45 || $char == 8 || $mozChar == 13) $RetVal = true; else { $RetVal = false; } } else { if (($char >= 48 && $char <= 57) || ($char == 13) || ($char == 45)) $RetVal = true; else { $RetVal = false; } } return $RetVal; }</script>
<!--For custom scroll section-->
我对邮寄服务器的位置感到困惑,我的网站真的需要吗?如何将其合并到我的脚本中? 谢谢。