<?php
if (isset($_POST["sendMessage"])) {
$firstName = $_POST['firstName'];
$lastName = $_POST['last-name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$from= '[email protected]';
$to = '[email protected]';
$subject = 'Message from Contact Demo ';
$txt= 'demo';
$headers = "From: [email protected]" . "\r\n" .
"CC: [email protected]";
$body = "From: First-Name: $firstName\n Last-Name: $lastName\n
E-Mail: $email\n Phone: $phone\n Message: $message";
$errFirstName='';$errLastName='';$errEmail='';$errPhone='';$errMessage='';
// If there are no errors, send the email
if (mail ($to, $subject,$txt,$headers)) {
$result='<div class="alert alert-success">Thank You! I will be in touch</div>';
} else {
$result='<div class="alert alert-danger">Sorry there was an error sending your message. Please try again later</div>';
}
}
?>
私はメールの検証をしようとしていますが、成功しないメッセージやエラーメッセージを出すテキストはありません。何も表示されません。私は自分の責任を理解できません。助けてください。PHPでの電子メールの検証?
ここでメールの確認コードはありませんでしたか? –
結果やエラーがある場合はそれを指定できますか? –
あなたはドイツ語ですか?あなたは英語で "will"という言葉の意味をgoogleする必要があります。それに加えて、変数名... 'firstName'と' last-name'でもっと一定にしてみてください。悪い習慣です。また、あなたの質問を編集し、あなたの電子メールのアドレスを削除し、いくつかのランダムなものと置き換えることができます...それは良いアイデアは、公共のボードにあなたの電子メールアドレスを投稿するとは思わない。また、あなたは '$ errFirstName = ''; $ errLastName = '';'で達成しようとしているのですか? – Twinfriends