我有我的HTML联系人表格和我的PHP帖子。使用我的网站Live ...提交表单时,我进入“ 405 Not Allowed”页面。我是PHP的新手,现在迷路了。
在一些在线教程之后...有一个index.php。我猜这是单击提交时页面转到的位置。
contact.html:
<form method="post" class="contact-form" action="contactform.php">
<div class="form_settings">
<p><span>Subject</span><input class="contact" type="text" name="subject" value="" /></p>
<p><span>Name</span><input class="contact" type="text" name="name" value="" /></p>
<p><span>Email Address</span><input class="contact" type="text" name="mail" value="" /></p>
<p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="message"></textarea></p>
<div class="button">
<p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="submit" value="submit" /></p>
</div>
</div>
</form>
contactform.php:
if (isset($_POST['submit'])){
$name = $_POST['name'];
$subject = $_POST['subject'];
$mailFrom = $_POST['mail'];
$message = $_POST['message'];
$mailTo = "xxxxxxxx@yahoo.com";
$headers = "Form: ".$mailFrom;
$txt = "You have received an E-mail from ".$name.".\n\n".$message;
mail($mailTo, $subject , $message, $headers);
header("Location: index.php?mailsend");
index.php
<?php
echo "Hello world!";
?>