提问人:Creative World 提问时间:9/8/2023 更新时间:9/8/2023 访问量:53
此页面无法正常工作 如果问题仍然存在,请与网站所有者联系。HTTP 错误 405 [已关闭]
This page isn’t working If the problem continues, contact the site owner. HTTP ERROR 405 [closed]
问:
这是我的联系表格,我正在尝试让它能够向我的电子邮件发送消息
我已经在 chrome 浏览器的 Windows 上运行了这个
<!--
- #CONTACT
-->
<article class="contact" data-page="contact">
<header>
<h2 class="h2 article-title">Contact</h2>
</header>
<section class="contact-form">
<h3 class="h3 form-title">Contact Form</h3>
<form action="process.php" method="post" class="form" data-form>
<div class="input-wrapper">
<input type="text" name="fullname" class="form-input" placeholder="Full name" required data-form-input>
<input type="email" name="email" class="form-input" placeholder="Email address" required data-form-input>
</div>
<textarea name="message" class="form-input" placeholder="Your Message" required data-form-input></textarea>
<button class="form-btn" type="submit" disabled data-form-btn>
<ion-icon name="paper-plane"></ion-icon>
<span>Send Message</span>
</button>
</form>
</section>
</article>
这是我的进程.php文件:
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$to = "######@gmail.com"; // Your email address
$subject = "New Contact Form Submission";
// Get form data
$fullname = $_POST["fullname"];
$email = $_POST["email"];
$message = $_POST["message"];
// Create email message
$email_message = "Name: $fullname\n";
$email_message .= "Email: $email\n";
$email_message .= "Message:\n$message";
// Set headers
$headers = "From: $email";
// Send email
if (mail($to, $subject, $email_message, $headers)) {
// Email sent successfully
echo "success"; // You can customize this response if needed
} else {
// Email sending failed
echo "error"; // You can customize this response if needed
}
} else {
// Invalid request
http_response_code(403);
echo "Forbidden";
}
请帮助我解决我正在尝试解决此问题的错误,但找不到任何解决方案 任何帮助都会有所帮助
答: 暂无答案
评论
method="post"