dozr162106 2013-08-20 19:09
浏览 65
已采纳

Wordpress给我php格式的404错误

Since the Wordpress form seems to not want to send me the password to my account for help on their forums I figured I would start here.

I have created a form for my website so that someone can contact us.

But when the person clicks the 'send' button it takes them to a 404 page, which the address reads:

website address - /working/mail.php

I know Wordpress supports .php files and I have mine correctly named and wasn't sure if I am missing something

    <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>

Here is my .php file:

<?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
";
$headers .= "Content-type: text/html
";
$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";
?>

I have never created a form before, but Wordpress plug-ins are terrible designed and/or over complicate the form giving me little control over what I want in it.

Any help is much appreciated.

  • 写回答

3条回答 默认 最新

  • doujiang2641 2013-08-20 23:42
    关注

    After time spent with the OP to find out what the problem was, have determined the following solution:

    Set your your form action to this

    <form action="/working/wp-content/themes/NEW/mail.php" method="post" name="contactFGS" id="contactFGS">
    

    Since the mail.php file (handler) was inside a themes folder, and not as previously thought.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装