我希望在表单提交后有一个提醒框,而不是重定向到thank-you.html
I want an alert box after form submit not redirect to thank-you.html
我想在提醒框中说声谢谢,而不是重定向到thank-you.html
这是我的代码:
<?php
if (!isset($_POST['submit']))
{
//This page should not be accessed directly. Need to submit the form.
echo "error; you need to submit the form!";
}
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$contact = $_POST['contact']$message = $_POST['message'];
//Validate first
if (empty($name) || empty($visitor_email))
{
echo "Name and email are mandatory!";
exit;
}
if (IsInjected($visitor_email))
{
echo "Bad email value!";
exit;
}
$email_from = 'tom@amazing-designs.com'; //<== update the email address
$email_subject = "New Form submission";
$email_body = "You have received a new message from the user $name.'n" . "Here is the message:'n $message" .
$to = "tom@amazing-designs.com"; //<== update the email address
$headers = "From: $email_from 'r'n";
$headers .= "Reply-To: $visitor_email 'r'n";
//Send the email!
mail($to, $email_subject, $email_body, $headers);
//done. redirect to thank-you page.
header('Location: thank-you.html');
我不想将页面重定向到thank-you.html
。我只想用";谢谢";。
删除标头('Location:thank-you.html');并添加javascript
<script>
alert('Thank you!!!');
</script>
将header()
部件替换为:printf("<script> alert('Thank You!'); </script>");
相关文章:
- 通过javascript重定向html传递php变量
- 使用angular重定向到html页面
- 如何在chrome扩展中重定向到html页面
- 使用ajax进行HTML重定向
- 如何重定向到我的html网站youtube嵌入视频打开在youtube应用程序
- 重定向到Angular JS中的另一个HTML页面
- 使用JavaScript制作动态HTML页面以重定向到URL
- 张贴HTML表单后重定向
- HTML表单重定向
- 按钮don't使用onClick-Javascript HTML重定向
- 如何防止 swf 重定向父 html
- 在Kentico中使用response.write重定向HTML表单不起作用
- 如果错误,如何防止页面重定向?(HTML/JavaScript)
- 如果不登录,则重定向 HTML 页面
- 提交表单后重定向(HTML,PHP)
- 正在更改重定向HTML代码以在同一窗口中打开
- 重定向HTML.BeginForm MVC 4的问题
- 用javascript重定向html页面
- 当填充输入成功时重定向html
- 如何重定向HTML表单提交到iframe