私はこの質問に既に回答している可能性があることを知っていますが、私が得た特定のケースを見つけることはできません。お問い合わせフォームにエラーがあり、アクションPHPスクリプトを起動しません
だから、私のコンタクトフォームは次のようになります。
<div id="contact-form">
<div id="message"></div>
<form method="POST" action="php/contact.php" name="contactform" id="contactform">
<input name="name" type="text" id="name" class="inputForm2" onclick="this.select()" value="Name">
<input name="email" type="text" id="email" onclick="this.select()" value="E-mail">
<textarea name="comments" id="comments" onclick="this.select()">Message</textarea>
<input type="submit" class="send_message transition" id="submit" value="Send Message">
</form>
</div>
とPHPスクリプト
function isEmail($email) { Skipped this one to save space }
if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n");
$name = $_POST['name'];
$email = $_POST['email'];
$content = $_POST['comments'];
if(trim($name) == '') {
echo '<div class="error_message">Enter your name.</div>';
exit();
} else if(trim($email) == '') {
echo '<div class="error_message">Enter a valid email address.</div>';
exit();
} else if(!isEmail($email)) {
echo '<div class="error_message">You have enter an invalid e-mail address, try again.</div>';
exit();
} else if(trim($content) == '') {
echo '<div class="error_message">Enter your message.</div>';
exit();
}
if(get_magic_quotes_gpc()) {
$comments = stripslashes($comments);
}
$emailTo = "[email protected]";
$subject = 'Youve been contacted by ' . $name . '.';
$e_body = "You have been contacted by: $name" . PHP_EOL . PHP_EOL;
$e_reply = "E-mail: $email\r\nPhone: $phone";
$e_content = "Message:\r\n$comments" . PHP_EOL . PHP_EOL;
//$content = wordwrap($e_body . $e_content . $e_reply, 70);
$headers = "From: $email" . PHP_EOL;
$headers .= "Reply-To: $email" . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
if(mail($emailTo, $subject, $content, $headers)) {
echo "<fieldset>";
echo "<div id='success_page'>";
echo "<h3>Email Sent Successfully.</h3>";
echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>";
echo "</div>";
echo "</fieldset>";
} else {
echo 'ERROR!';
}
あなたはこれで間違っているものを私を指してもらえますか?
何が問題ですか?何が起こっていますか? – Araz