我有我的WordPress網站一個簡單的形式,它允許用戶登錄到一個通訊:PHP/HTML新聞稿
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 = "[email protected]";
$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。
我會在你的主題中構建一個頁面模板,並在其中放置newsletter.php。將模板分配給Wordpress中的頁面,您就可以輕鬆前往。 – 2013-04-26 16:36:22
@RelevantUsername這並不是最乾淨和最簡單的方法。你正在爲這個問題引入一種全新的語言。 – 2013-04-26 16:37:15
謝謝你們,猜我忘了提及我既不認識Ajax也不認同JavaScript :)現在嘗試在互聯網上找到一些代碼......編輯:尼古拉斯,這聽起來像一個好方法。我會先嚐試一下。 – Kev89 2013-04-26 16:41:01