联系人表格问题(html和php):不允许405 [英] Issue with contact form (html and php): 405 not allowed

查看:105
本文介绍了联系人表格问题(html和php):不允许405的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用HTML和PHP制作一个非常基本的联系表。但是,由于某些原因,当我单击提交按钮时,出现错误 405不允许。为什么?我该如何解决? (我的网站托管在GitHub上)

I'm trying to make a very basic contact form using HTML and PHP. For some reason, however, when I click the "submit" button I get the error "405 Not Allowed". Why? How could I fix this? (I'm hosting my website on GitHub)

我的HTML:

<!DOCTYPE html>
<html>


<head>
    <title></title>
</head>
<body>

    <form action="send_form_email.php" method="POST">
            <input type="text" name="name" placeholder="Full Name">
            <input type="text" name="mail" placeholder="Your e-mail">
            <input type="text" name="subject" placeholder="Subject">
            <textarea name="message" placeholder="Message"></textarea>
            <button type="submit" name="submit">Send e-mail</button>
    </form>

</body>


</html>

我的PHP:

<?php

if (isset($_POST['submit'])) {
$name = $_POST['name'];
$subject = $_POST['subject'];
$mailFrom = $_POST['mail'];
$message = $_POST['message'];


$mailTo = "example@gmail.com";
$headers = "From: ".$mailFrom;
$txt = "You have received an e-mail from ".$name.".\n\n".$message;

mail($mailTo, $subject, $txt, $headers);
header("Location: index.php?mailsend");
}

(PS。我之所以写了 example@gmail.com

(PS. I wrote "example@gmail.com" just because I wanted to keep my personal e-mail private on here.

PPS。我一直在尝试制作一个非常简单的联系表格(您写上自己的名字和消息以及所有者的网站在收件箱中收到了它),但我的(绝望)尝试似乎都没有效果。有人可以帮我吗?)

PPS. I have been trying to make a very simple contact form (you write your name mail and message and the owner of the website receives it in the inbox) but none of my (desperate) attempts seems to work. Can anyone help me out?)

推荐答案

Github是静态网页的托管服务。 PHP不是静态的。 部署PHP到GitHub Pages-有可能吗?

Github is a hosting service for static web pages. PHP is not static. Deploying PHP to GitHub Pages - is it possible?

这篇关于联系人表格问题(html和php):不允许405的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆