私はここでちょっと新しいです。私は自分でウェブサイトを作ろうとしましたが、ほぼ完成しましたが、私のコンタクトフォームに情報を送るという問題を解決することはできません。私はオプションのサブミットをクリックすると私のページは同じページのままになりません
このページは次のとおりです:ramproducciones.pe(スペイン語) 最後に近づくと連絡先フォームが見つかると、データが正しく入力されてもメールが送信されますが、次は空白ですページが表示されます。私が欲しいのは、ありがとうと言うメッセージを受け取ったということです!あなたのメッセージは送信されましたが、私はそれを行う方法がわかりません。私は多くのコードをコピーしようとしたと私は現在、この持っている:私はまだ問題を解決することはできませんしかし
<!-- contacto-->
<section class="contact" id="contact">
<h1>Contacto</h1>
<hr/>
<div class="content">
<div class="form">
<form method="post" action="mail.php" name="contact">
<div class="column">NOMBRE<br/><br/>
<input name="name" id="name" value="" />
</div>
<div class="column-2">E-MAIL<br/><br/>
<input name="email" id="email" value="" />
</div>
<div class="column-3">MENSAJE<br/><br/>
<textarea id="message" name="message" ></textarea>
</div>
<div class="button">
<span><input class="submit" id="submit" name="submit" type="submit" value="ENVIAR"></span>
</div>
<div id="dialog-message" title="Thank You">
<p>¡Gracias! Tu mensaje ha sido enviado, te responderemos lo antes posible.</p>
</div>
</form>
</div>
<div class="contact-text">
No dudes en solicitarnos información.<br/><br/>
<strong>RAM Producciones</strong><br/><br/>
e-mail: <strong>[email protected]</strong>
<br/><br/>
<a href="https://facebook.com/RAMproduccionesSAC" target="_blank"><img src=img/social/Facebook.png /></a>
<a href="https://vimeo.com/ramproduccionessac" target="_blank"><img src=img/social/Vimeo.png /></a>
<a href="https://www.behance.net/RAMProduccionesSAC" target="_blank"><img src=img/social/Behance.png /></a>
<a href="https://www.instagram.com/ram.producciones" target="_blank"><img src=img/social/Instagram.png /></a>
<a href="https://www.youtube.com/channel/UCIF9shcqE4D5cF5Xp7LBasg" target="_blank"><img src=img/social/Youtube.png /></a>
</div>
</div>
</section>
を、PHPは
<?php
// define variables and set to empty values
$name_error = $email_error = "";
$name = $email = $message = $success = "";
//form is submitted with POST method
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$name_error = "Name is required";
} else {
$name = test_input($_POST["name"]);
// check if name only contains letters and whitespace
if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
$name_error = "Solo ingresa letras y espacios.";
}
}
if (empty($_POST["email"])) {
$email_error = "Tu E-mail es necesario";
} else {
$email = test_input($_POST["email"]);
// check if e-mail address is well-formed
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$email_error = "Formato de E-mail inválido";
}
}
if (empty($_POST["message"])) {
$message = "";
} else {
$message = test_input($_POST["message"]);
}
if ($name_error == '' and $email_error == '' and $phone_error == '' and $url_error == ''){
$message_body = '';
unset($_POST['submit']);
foreach ($_POST as $key => $value){
$message_body .= "$key: $value\n";
}
$to = '[email protected]';
$subject = 'Mail vía RAMPRODUCCIONES.PE';
if (mail($to, $subject, $message)){
$success = "¡Gracias! Tu mensaje ha sido enviado, te responderemos lo antes posible.";
$name = $email = $message = '';
}
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
です。
あなたの行動です。 – clearshot66
そのメール.phpファイル。 –
フォームが送信されると、フォームタグに 'action =" mail.php "'を付けて別のページに送ります。また、 'test_input()'関数はほとんど役に立たず、単に "セキュリティ"を提供するのではなく、データを変更するだけです。 – Qirel