在收到表单信息后发送/重定向查看器到URL


Sending/redirecting viewer to URL after receiving form info

我使用绑定到JS和PHP的表单来捕获表单信息并发送电子邮件地址…但我也想发送查看器在点击"提交"被发送到一个特定的URL…JS和PHP新手。事先感谢您的帮助。

用PHP发送邮件后:

header('location:http://example.com');

也可以在发送数据后使用refresh meta tag:

 echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='www.example.com'">';

Javascript中:

window.location = '/some/page.php';

如果你通过Javascript提交表单。如果让表单的action先运行,那么使用PHP的header函数:

header('Location: /some/page.php');