Javascript 需要帮助我的html联系形式的大学
基本上,我是一个巨大的网页设计初学者,我需要帮助确定我实际上把我的电子邮件作为收件人放在这个联系表格中我已经看了5次代码,我知道我可能错过了它的某个地方,但有人能告诉我在代码中我把我的电子邮件地址作为收件人放在哪里 以下是代码的链接: 这是我的html,其余的在JSFIDLE上Javascript 需要帮助我的html联系形式的大学,javascript,html,css,forms,contact,Javascript,Html,Css,Forms,Contact,基本上,我是一个巨大的网页设计初学者,我需要帮助确定我实际上把我的电子邮件作为收件人放在这个联系表格中我已经看了5次代码,我知道我可能错过了它的某个地方,但有人能告诉我在代码中我把我的电子邮件地址作为收件人放在哪里 以下是代码的链接: 这是我的html,其余的在JSFIDLE上 <head> <meta charset="UTF-8"> <title>{name} Portfolio - {Page Name}</title>
<head>
<meta charset="UTF-8">
<title>{name} Portfolio - {Page Name}</title>
<!-- grabs the latest jquery script from google -->
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/processForm.js"></script>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="contactForm">
<div id="contactForm_messageToUser">Your message has been sent.<br />We will be in contact shortly.</div>
<!-- The form that the user will fill out. -->
<form id="contactForm_form">
<table>
<tr>
<th>
Name
</th>
<td>
<input id="user_name" name="user_name" type="text" value="" />
<div id="user_name_message" class="errorMessage">
Please enter your name.
</div>
</td>
</tr>
<tr>
<th>Phone</th>
<td>
<input id="user_phone" name="user_phone" type="text" value="" />
<div id="user_phone_message" class="errorMessage">
Please enter a valid phone number.
</div>
</td>
</tr>
<tr>
<th>Email</th>
<td>
<input id="user_email" name="user_email" type="text" value="" />
<div id="user_email_message" class="errorMessage">
Please enter a valid email address.
</div>
</td>
</tr>
<tr>
<th>Message</th>
<td>
<textarea id="user_message" name="user_message"></textarea>
<div id="user_message_message" class="errorMessage">
Please enter your message.
</div>
</td>
</tr>
<tr>
<th> </th>
<td>
<input id="user_submit" name="user_submit" type="submit" value="Send your message" />
</td>
</tr>
</table>
</form>
</div>
</body>
{name}公文包-{Page name}
您的邮件已发送。
我们将很快与您联系。
名称
请输入您的姓名。
电话
请输入有效的电话号码。
电子邮件
请输入有效的电子邮件地址。
消息
请输入您的信息。
如果您希望依靠浏览器使用outlook或用户的客户端发送电子邮件 使用
虽然这不是一个好主意,因为大多数人只是使用webamil。因此,您需要一个服务器来转发电子邮件。您需要用php、asp、java或其他语言编写代码,或者使用允许转发电子邮件的服务如果您正在查找填写好的表单将发送到的电子邮件地址,则该地址不在此处。表单是通过对服务器端脚本的AJAX调用提交的
processEmail.php
-在那里查找地址假设您希望将通过表单提交的信息发送到您的电子邮件地址,这就是您需要在processEmail.php中更改的内容:
<?php
if (isset($_POST['user_submit']) && $_POST['user_submit'] != ''){
$body = "Name: " . $_POST['user_name'] . "<BR>";
$body.= "Phone: " . $_POST['user_phone'] . "<BR>";
$body.= "Email: " . $_POST['user_email'] . "<BR>";
$body.= "Message: " . $_POST['user_message'];
$to = "Your Email Address";
$subj = "User Form Submitted";
$headers = "MIME-Version: 1.0\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\n";
$headers.= "From: ".$_POST['user_email']."\n";
if (mail($to,$subj,$body,$headers)){
echo "<h2>Message Sent</h2>";
}
else{
echo "<h2>Unable to submit the form, please recheck the details.</h2>" ;
}
}
“Java”与“JavaScript”的关系就像“Car”与“地毯”的关系一样。好吧,不知道那在哪里,老师没有提供文件,我得到的只是我贴的东西
<?php
if (isset($_POST['user_submit']) && $_POST['user_submit'] != ''){
$body = "Name: " . $_POST['user_name'] . "<BR>";
$body.= "Phone: " . $_POST['user_phone'] . "<BR>";
$body.= "Email: " . $_POST['user_email'] . "<BR>";
$body.= "Message: " . $_POST['user_message'];
$to = "Your Email Address";
$subj = "User Form Submitted";
$headers = "MIME-Version: 1.0\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\n";
$headers.= "From: ".$_POST['user_email']."\n";
if (mail($to,$subj,$body,$headers)){
echo "<h2>Message Sent</h2>";
}
else{
echo "<h2>Unable to submit the form, please recheck the details.</h2>" ;
}
}