我已经用HTML创建了一个表单,使用PHP收集提交的信息,将其发送到我的数据库,并通过用户输入给自己发送电子邮件。
目前,当用户提交表单时,他们会被带到一个页面,感谢他们使用此代码进行查询:
mail($emailID, $subject, $body, $headers );
echo "<h4>Thank you for sending us an enquiry. We will get back to you as soon as possible. </h4> ";
此消息是否可以设置为短时间显示,然后重定向到以前的URL?我知道以下javascript可用于实现此目的但是如果有人没有启用javascript,它们将被卡住:
mail($emailID, $subject, $body, $headers );
echo "<h4>Thank you for sending us an enquiry. We will get back to you as soon as possible. </h4> ";
echo "<script>setTimeout(\"location.href = 'http://www.mysite.com/page.html';\",1500);</script>";
是否有一个简单的PHP选项来实现这个目标?
谢谢!
答案 0 :(得分:0)
你可以尝试
等等。
mail($emailID, $subject, $body, $headers );
echo "<h4>Thank you for sending us an enquiry. We will get back to you as soon as possible. </h4>";
flush(); // Will execute the above and continue
sleep('seconds'); //if you want to add some waiting time
// More PHP code here
header('Location: url');