使用PHP将表格发送到我的电子邮件..提交表单时有405不允许的问题

在从我创build的表单获取数据的问题,并通过PHP传递给我的电子邮件。 这里是http://kapena.github.io/pp_web/#contact-pp的链接

这是确切的问题..当我点击提交表单button,我得到这个错误消息说.. 错误信息

我目前正在主页上构build这个版本

我做了一些研究,我发现了一个错误405的补丁,但我不知道如何实现这个解决scheme到我的项目。 我只是一个初学者,我需要一些说明..这里的解决scheme,我发现https://gist.github.com/baskaran-md/e46cc25ccfac83f153bb#file-nginx-conf

我怎样才能正确实施这个解决scheme到我的网站?
这里是我的PHP代码,所以你可以检查,看看是否有问题,并导致这个问题。

任何帮助将不胜感激在这里..试图发射b4新的一年:)

<?php if($_POST["submit"]) { $recipient = "brentw.white@gmail.com"; //my email $subject = 'Email message from Point Plumbing'; $name = $_POST ["yourName"]; $email = $_POST["yourEmail"]; $phone = $_POST["yourPhone"]; $location = $_POST["yourLocate"]; $message = $_POST["message-me"]; $mailBody="Name: $name\nEmail: $email\n\n$message"; $mail($recipient, $subject, $mailBody, "From: $name <$email>"); $thankYou="<p>Thank you! We will be in contact with you shortly.</p>"; } ?> 

我的HTML ..我有一种感觉,它与method='post'可能是这样的问题?

 <form action="submit_form.php" method="post" id="spaceing" data-abide> <div class="form-bg"> <div class="row"> <div id="name" class="large-6 medium-6 small-12 columns"> <label> <h5>Name</h5> <input type="text" name="yourName" placeholder="What is you're name?"></input> </label> </div> <div id="email" class="large-6 medium-6 small-12 columns"> <label><h5>Email</h5> <input type="email" name="yourEmail" placeholder="Please enter in you're email."required></input> </label> <small class="error">An email Address is required.</small> </div> </div> <div class="row"> <div id="phone"class="large-6 medium-6 small-12 columns"> <label><h5>Phone</h5> <input type="text" name="yourPhone" placeholder="Please enter you're phone number."></input> </label> </div> <div id="location" class="large-6 medium-6 small-12 columns"> <label><h5>Location</h5> <input type="text" name="yourLocate" placeholder="Where on Oahu are you currently living?"></input> </label> </div> </div> <div class="row"> <div id="message-area" class="large-12 medium-12 small-12 columns"> <label><h5>Message</h5> <textarea id="message" name="yourMessage" placeholder="Please tell us about you're plumbing issues."></textarea> </label> </div> </div> <div class="row"> <div id="submit" class="large-3 medium-3 small-3 columns"> <button type="submit-me">Submit</button> </div> </div> </div> </form> 

http://php.net/manual/en/function.mail.php

 $mail($recipient, $subject, $mailBody, "From: $name <$email>"); 

那么$ mail是不可变的

 mail($recipient, $subject, $mailBody, "From: $name <$email>"); 

我修改你的代码,并找到很多error.orrect代码如下: – 找到以下错误代码1.使用if(isset($ _ POST [“提交”])){而不是if($ _ POST [“submit”] ){2.你使用错误的变量名称为textarea。 你应该使用$ message = $ _POST [“yourMessage”]; 而不是$ message = $ _POST [“message-me”]; 4.另一个错误是你的表单操作在submit_form.php页面,但我发现你的邮件代码是在你的页面顶部。 如果你想提交到另一个页面,然后使用php代码submit_form.php页面。 5.你的代码的主要和重要的错误,我发现你在发送邮件的地方使用你的Gmail邮件,但你应该使用你的域名的电子邮件,如brentw.white@kapena.github.io如果你使用另一个域电子邮件这些邮件是数作为可疑和你的邮件去垃圾邮件我认为这将是帮助完整的你我用你的链接在这里: – http://smartzonewebservices.com/mtg/del.php

 <?php if(isset($_POST["submit"])) { $recipient = "brentw.white@gmail.com"; //my email echo $subject = 'Email message from Point Plumbing'; echo $name = $_POST ["yourName"]; echo $email = $_POST["yourEmail"]; echo $phone = $_POST["yourPhone"]; echo $location = $_POST["yourLocate"]; echo $message = $_POST["yourMessage"]; $mailBody="Name: $name\nEmail: $email\n\n$message"; mail($recipient, $subject, $mailBody, "From: $name <$email>"); echo $thankYou="<p>Thank you! We will be in contact with you shortly.</p>"; } ?> <form action="" method="post" id="spaceing" data-abide> <div class="form-bg"> <div class="row"> <div id="name" class="large-6 medium-6 small-12 columns"> <label> <h5>Name</h5> <input type="text" name="yourName" placeholder="What is you're name?"></input> </label> </div> <div id="email" class="large-6 medium-6 small-12 columns"> <label><h5>Email</h5> <input type="email" name="yourEmail" placeholder="Please enter in you're email."required></input> </label> <small class="error">An email Address is required.</small> </div> </div> <div class="row"> <div id="phone"class="large-6 medium-6 small-12 columns"> <label><h5>Phone</h5> <input type="text" name="yourPhone" placeholder="Please enter you're phone number."></input> </label> </div> <div id="location" class="large-6 medium-6 small-12 columns"> <label><h5>Location</h5> <input type="text" name="yourLocate" placeholder="Where on Oahu are you currently living?"></input> </label> </div> </div> <div class="row"> <div id="message-area" class="large-12 medium-12 small-12 columns"> <label><h5>Message</h5> <textarea id="message" name="yourMessage" placeholder="Please tell us about you're plumbing issues."></textarea> </label> </div> </div> <div class="row"> <div id="submit" class="large-3 medium-3 small-3 columns"> <button name="submit" type="submit">Submit</button> </div> </div> </div> </form> 

我的事情,这是因为你在Github服务器上开发,他不允许进行POST更改您的代码HTML:

 <form action="submit_form.php" method="get" id="spaceing" data-abide> 

和PHP更改$ _POST为$ _GET,但有长度的问题,因为所有数据都在URL中发送。

如果你想让普通服务器的公共页面返回到POST方法