我正在尝试为我的网站创建一个托管在Github上的表单,当我按下提交按钮时,我看到一个页面说:发出的请求是禁止的内容。我能做错什么?
HTML:
<form method="post" action="index.php">
<label>Name</label>
<input name="name" placeholder="Type Here">
<label>Email</label>
<input name="email" type="email" placeholder="Type Here">
<label>Message</label>
<textarea name="message" placeholder="Type Here"></textarea>
<label>*Wat is 2+2? (Anti-spam)</label>
<input id="submit" name="submit" type="submit" value="Submit">
PHP:
<!DOCTYPE html>
<html>
<body>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: insert';
$to = 'placeholder@placeholder.com';
$subject = 'Iemand heeft een bericht achter gelaten..';
$human = $_POST['human'];
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if ($_POST['submit'] && $human == '4') {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Jouw bericht is verstuurd!</p>';
} else {
echo '<p>Er is iets fout gegaan, probeer het later opnieuw.</p>';
}
} else if ($_POST['submit'] && $human != '4') {
echo '<p>Het antwoord op de vraag is onjuist!</p>';
} else {
echo '<p>Graag alle velden invullen!</p>';
}
?>
</body>
</html>
索引和索引php文件位于同一目录