이름, 주소 및 전화 번호가 필요한 랜딩 페이지 (http://www.interiorswithaview.com/)가 있습니다. 다운로드와 함께 감사 페이지로 이동 한 양식을 제출 한 후 http://www.interiorswithaview.com/ThankYou.html 나는 또한 자바 스크립트 (아래 참조)를 사용합니다. 과거에이 템플리트 세트를 사용했는데 그 것이 작동하지만 이제 이메일을 보내지 않음을 알고 있습니다. 나는 그것의 구식 경우 몰라? 도와주세요.내 html 양식에서 이메일을 보내지 않았습니다.
<script src="mail-form.js"></script>
<form method="POST" action="mailer.php" onsubmit="return ValidateRequiredFields();" name="mail">
<table width="235" height="400" border="0" bgcolor="#d1d3d4" align="center" cellpadding="0" cellspacing="0" style="font-size:13px; font-weight:bold; color:#58585b; padding:5px;">
<tbody>
<tr><td colspan="3"><img src="images/Form-header.png" width="200" height="63" alt="" align="center"/></td></tr>
<tr>
<td colspan="3">
<p align="center" style="padding:0 8px 0 8px;"><strong>Here are three informational guides to help you get started! To download these resources, just enter your information below.</strong></p>
<p>
<ul style="list-style: none; font-size: 16px; color: #d83e45;">
<li>Q & A</li>
<li>Case Study</li>
<li>Color Consultation</li>
</ul>
</p>
</td>
</tr>
<tr>
<td width="55" height="30" align="right" style="padding-right:6px;">Name:</td>
<td width="163" align="right">
<input name="Name" type="text" id="Name" size="23">
</td>
</tr>
<tr>
<td height="30" align="right" style="padding-right:6px;">Address:</td>
<td align="right"><input name="Address" type="text" id="Address" size="23"></td>
</tr>
<tr>
<td height="30" align="right" style="padding-right:6px;">Phone:</td>
<td align="right"><input name="Phone" type="text" id="Phone" size="23"></td>
</tr>
<tr>
<td height="5" align="right" style="padding-right:6px;"> </td>
<td align="right"> </td>
</tr>
<tr>
<td height="5" align="right" style="padding-right:6px;"> </td>
<td align="right"><input type="submit" name="submit" id="submit" value="Submit" /></td>
<td width="1"></td>
</tr>
</tbody>
</table>
</form>
PHP 코드
<?php
if(isset($_POST['submit'])) {
$email_to = "[email protected]";
$subject = "New Landing Page Consult Lead";
$name_field = $_POST['Name'];
$address_field = $_POST['Address'];
$phone_field = $_POST['Phone'];
$body = "From: $name_field\n Address: $address_field\n Phone: $phone_field\n";
header('Location: ThankYou.html');
exit();
mail($to, $subject, $body, "From: $name_field");
}
else {
echo "what?";
}
?>
자바 스크립트
var FormName = "mail";
var RequiredFields = "Name,Phone,Address";
function ValidateRequiredFields() {
var FieldList = RequiredFields.split(",");
var BadList = new Array();
for(var i = 0; i < FieldList.length; i++) {
var s = eval('document.' + FormName + '.' + FieldList[i] + '.value');
s = StripSpacesFromEnds(s);
if(s.length < 1) {
BadList.push(FieldList[i]);
}
}
if(BadList.length < 1) {
return true;
}
var ess = new String();
if(BadList.length > 1) {
ess = 's';
}
var message = new String('\n\nThe following field' + ess + ' are required:\n');
for(var i = 0; i < BadList.length; i++) {
message += '\n' + BadList[i];
}
alert(message);
return false;
}
function StripSpacesFromEnds(s) {
while((s.indexOf(' ',0) == 0) && (s.length> 1)) {
s = s.substring(1,s.length);
}
while((s.lastIndexOf(' ') == (s.length - 1)) && (s.length> 1)) {
s = s.substring(0,(s.length - 1));
}
if((s.indexOf(' ',0) == 0) && (s.length == 1)) {
s = '';
}
return s;
}
는,이 라인을 이동 : '메일 ($ "보낸 사람 : $의 name_field"$ 제목, $ 바디에)'이 줄 앞에 :'헤더 ('위치 : 감사합니다. html ');' – EhsanT