我刚刚实现了一个php联系表单,但是当我填写表单并点击提交按钮时,它会抛出HTTP ERROR 500。
我使用以下html标记和php代码。根文件夹中没有ini.php,我发现这是我问题的最多答案。
<form action="php/mail.php" method="post" enctype="multipart/form-data">
<input name="sender_name" placeholder="Your Name..."/>
<input name="sender_email" placeholder="Your email..."/>
<textarea placeholder="Your Message..." name="sender_message"></textarea>
<div class="captcha_wrapper">
<div class="g-recaptcha" data-sitekey="placeholder"></div>
</div>
<button type="submit" id="send_message">Send Message!</button>
<form>
<?php
$sender_name=stripslashes($_POST["fullname"]);
$sender_email=stripslashes($_POST["email"]);
$sender_message=stripslashes($_POST["message"]);
$secret="6LdFvi0UAAAAAD21HxZ1KkptlAIq06K12d8sTMWn";
$response=$_POST["g-recaptcha-response"];
$verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
$captcha_success=json_decode($verify);
$subject="Important Message".$_POST['subject'];
$headers= "From: ".$_POST['email']."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
$headers1="From: "."hello@placeholder.com"."\n";
$headers1.='Content-type: text/html; charset=iso-8859-1';
$success = mail("hello@placeholder.com", $subject,"Important Message You’ve received a message from YOUR website.
Message: “.$_POST[‘message’].”
Please Contact: “.$_POST[‘fullname’].”
Phone: “.$_POST[‘phone’].”
Email: “.$_POST[’email’].” ” , $headers);@mail($_POST[’email’],’YOUR-NAME’,$body1,$headers1);
if ($captcha_success->success==false) {
echo “You are a bot! Go away!”;
} else if ($captcha_success->success==true) {
print “”;
}
?>
您可以在http://atelier-rauen.de/test/contact
进行测试服务器上的权限是否有问题? php文件夹有0755和php文件0644。
感谢您的帮助!