这听起来很愚蠢,但是您能告诉我如何在单击“发送”后将人们重定向到 PHP 中的“谢谢”或“请稍后再试”页面吗?
我认为这与在回声中添加一些东西而不是我已经添加的消息有关,添加登录页面或类似的东西,但我只是想确定一下,你能帮忙吗?
PHP代码在这里:
function validateEmail($value){
return preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', $value);
}
if ( isset($_POST['last']) && $_POST['last']!="Nume" && isset($_POST['first']) && $_POST['first']!="Prenume" && isset($_POST['address']) && $_POST['address']!="Adresă" && isset($_POST['email']) && $_POST['email']!="Email" && isset($_POST['phone']) && $_POST['phone']!="Telefon" && isset($_POST['message']) && $_POST['message']!="Ai întrebări legate de produse? Scrie-mi şi îţi voi răspunde în cel mai scurt timp." ) {
if ( validateEmail($_POST['email']) ) {
$destination="brilliancedisplay@outlook.com";
$subject="Sunt ceva nelamuriri in magazin!";
$mailMessage.="<dt><strong>Nume:</strong></dt><dd>".$_POST['last']."</dd>";
$mailMessage.="<dt><strong>Prenume:</strong></dt><dd>".$_POST['first']."</dd>";
$mailMessage.="<dt><strong>Adresa:</strong></dt><dd>".$_POST['address']."</dd>";
$mailMessage.="<dt><strong>E-mail:</strong></dt><dd>".$_POST['email']."</dd>";
$mailMessage.="<dt><strong>Telefon:</strong></dt><dd>".$_POST['phone']."</dd>";
$mailMessage.="<dt><strong>Intrebari:</strong></dt><dd>";
$mailMessage.=nl2br($_POST['message'])."</dd></dl>";
$mailMessage = utf8_decode($mailMessage);
$mailFrom=$_POST['email'];
$mailHeader="From:".$mailFrom."\nReply-To:".$_POST['name']."<".$mailFrom.">\n";
$mailHeader=$mailHeader."X-Mailer:PHP/".phpversion()."\n";
$mailHeader=$mailHeader."Mime-Version: 1.0\n";
$mailHeader=$mailHeader."Content-Type: text/html";
if ( mail($destination,$subject,$mailMessage,$mailHeader) ) {
echo 'Comanda trimisa!';
}
else echo 'Eroare, va rugam incercati mai tarziu.';
}
else echo 'Introduceti o adresa de Email valida'; //EMAIL VALIDATION ERROR
}
else echo 'Completati toate spatiile!'; //VARS ERROR
?>