我的 WordPress 网站上有一个简单的表单,允许用户注册时事通讯:
HTML
<form method="POST" action="newsletter.php">
<input type="text" class="form" name="Email" size="20" placeholder="Email address">
<input type="submit" class="button" value="Submit" name="Submit"></p>
</form>
提交电子邮件地址后,用户将被重定向到一个名为 newsletter.php 的新站点,并显示以下消息:您的电子邮件地址已成功提交
PHP
<?php
$recipient = "blabla@mail.com";
$subject = "Newsletter subscription";
$sender = $recipient;
$body .= "Add this email adress to the newsletter: \n";
$body .= " ".$_REQUEST['Email']." \n";
mail( $recipient, $subject, $body, "From: $sender" ) or die ("Mail could not be sent.");
echo "Your email address has been successfully submitted";
?>
我现在想知道的是:如何在 WordPress 网站而不是 newsletter.php 上显示“成功消息”?
完美的解决方案是在注册表单下方打开一个小 div。