由于 Wordpress 表单似乎不想将密码发送到我的帐户以在他们的论坛上寻求帮助,我想我会从这里开始。
我为我的网站创建了一个表格,以便有人可以与我们联系。
但是当这个人点击“发送”按钮时,它会将他们带到一个 404 页面,地址如下:
网站地址 - /working/mail.php
我知道 Wordpress 支持 .php 文件,并且我的名称正确,但不确定我是否遗漏了什么
<div id="FGSform">
<form action="mail.php" method="post" name="contactFGS" id="contactFGS">
<ul>
<li>
<label for="first-name">First Name</label>
<br>
<input type="text" id="firstname" name="firstname" required aria-required="true">
</li>
<br>
<li>
<label for="last-name">Last Name</label><br>
<input type="text" id="lastname" name="lastname" required aria-required="true">
</li>
<br>
<li>
<label for="email">Email</label>
<br>
<input type="email" id="email" name="email" required aria-required="true">
</li>
<br>
<li>
<label for="contact-reason" id="reason" name="reason">Reason for Contact</label>
<select required id="reason" name="reason">
<option value="3">Employment</option>
<option value="1">Print Services</option>
<option value="2">Design Services</option>
<option value="4">Questions</option>
<option value="5">Other</option>
</select>
</li>
<br>
<li>
<label for="comments">Comments</label>
<br>
<textarea name="comments" id="comments" cols="40" rows="10" required></textarea>
</li>
<br>
<li>
<input type="radio" id="newsletter" name="newsletter">
<label for="signmeup">Sign me up for newsletter, updates and other information about FGS</label>
</li>
<br>
<li>
<input type="submit" value="Send">
</li>
这是我的 .php 文件:
<?php
/* Email Variables */
$emailSubject = 'mail!';
$webMaster = 'kmurray.1@frgraphicsolutions.com';
/* Data Variables */
$name = $_POST['name'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$email = $_POST['email'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Last Name: $lastname <br>
Email: $email <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://frgraphicsolutions.com/working/?page_id=8">
<style type="text/css">
<!--
body {
background-color: #444;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">Thank you!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
我以前从未创建过表单,但是 Wordpress 插件的设计很糟糕和/或使表单过于复杂,使我无法控制我想要的内容。
任何帮助深表感谢。