ユーザーは自分のウェブサイトにphpファイルを添付しているので、ユーザーは自分のメールにすべてのデータを送信していますが、ロード中いつでも内部サーバーエラーを表示しますメッセージを送信した後 は、これは私のコードです:コンタクトフォームの内部サーバーエラー
この形式は、ウェブサイト上のすべてのページにある
<form style="line-height:15px" name="contactform" action="send_form_email.php" method="post">
<input type="text" placeholder="Full Name" maxlength="50" class="txt" name="name" required><br><br>
<input type="text" placeholder="E Mail" class="txt" maxlength="80" name="email" required><br><br>
<textarea onkeyup="adjust_textarea(this)" placeholder="Message" class="txt" maxlength="1000" name="message" required></textarea><br><br>
<input type="text" placeholder="Phone No." class="txt" maxlength="30" name="phone" required><br><br><br>
<input type="submit" value="Send" class="btn">
</form>
send_form_email.phpそれはあなたのエラーが底の近くのアラート機能から来ていることは非常に可能です
<?php
$errors = '';
$myemail = '[email protected]';//<-----Put Your email address here.
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['name'];
$phone = $_POST['phone'];
$email_address = $_POST['email'];
$message = $_POST['message'];
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if(empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message\n $phone";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
alert('Thankyou for contacting us');
header('Location: index.php');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Contact form handler</title>
</head>
<body style="window.location='index.php'">
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
</body>
</html>
これは本当に重複と見なされますか?私は疑問が、存在しなかったPHPでalert()関数を呼び出そうとしたことによって引き起こされた内部サーバーエラーに関連しているように感じます。その後、ヘッダーの議論に進化しましたが、問題の根本は、私たちのうちの二人が適切に捕捉して答えた「警告(alert)」メソッドでした。ありがとう! –