[英]HTML contact form send email by php but after send not stay that page
我在 index.php 中使用這些代碼發送電子郵件
<?php
if (isset($_REQUEST['email'])) {
$admin_email = "md.alhussain365@gmail.com";
$email = $_REQUEST['email'];
$subject = "Website Visitor";
$message = $_REQUEST['message'];
mail($admin_email, "$subject", $message, "From:" . $email);
echo "Thank you for contacting us!";
else {
?>
form id="contact-form-face" class="clearfix" method="post">
<input type="email" name="email" value="Email" onFocus="if (this.value == 'Email') this.value = '';" onBlur="if (this.value == '') this.value = 'Email';" />
<textarea name="message" onFocus="if (this.value == 'Message') this.value = '';" onBlur="if (this.value == '') this.value = 'Message';">Message</textarea>
<input class="contact_btn" type="submit" value="Send message" />
</form>
<?php
}
?>
一切都如我所願。 喜歡發送消息后留在同一部分的頁面(聯系我們)。
但是現在我的客戶不想使用 index.php 她想使用 index.html
這就是為什么我將 php 代碼分離到其他文件中的原因。 它工作正常,但它正在進入新頁面並顯示我修復的一行文本。 但我需要像以前一樣保持頁面。
所以請告訴我,我怎么能像以前一樣做呢?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.