0
我在發送郵件後使用重定向的聯繫表格,但我希望用戶得到'郵件發送'提醒,將出現&消失在聯繫人表單上的某處。這意味着頁面不會刷新,用戶也不會從頁面或聯繫人表單中移除。這可能嗎?聯繫表格確認消息不刷新
如果因此可能有人告訴我的代碼,我需要添加到下面的電流...
我使用的格式如下:
<form id="contact-form-face" class="clearfix" action="http://www.demo.com/php/contactengine.php">
<input type="text" 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" name="submit" type="submit" value="Send Message" />
</form>
,而PHP的崗位:
<?php
$EmailFrom = "myemail";
$EmailTo = "myemail";
$Subject = "";
$Email = Trim(stripslashes($_POST['email']));
$Message = Trim(stripslashes($_POST['message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
任何幫助將不勝感激
你能一步一步地告訴我此基礎上我的代碼 - 我很抱歉,但我是很新,這與它是我的網站的最後階段,我要遲到與 – MKDesigns
好吧,現在我跑'正被重定向到一個只有'1'的頁面。爲什麼是這樣? – MKDesigns