如何在php邮件上更改谢谢你的消息

时间:2015-10-09 07:28:58

标签: php twitter-bootstrap phpmailer

我正在关注设置我自己的php邮件的这个小教程。它在这里。 http://www.tudor-anghelina.com/2013/09/how-to-create-php-bootstrap-3-contact.html

然而,在第37行,它有:

/* Redirect visitor to the thank you page */
header('Location: http://address-of-confirmation-page.html');
exit();

我没有PHP的经验,但是有没有办法让消息说出"感谢您的留言"在与表格相同的页面上?我真的不想被重定向到另一个.html页面。

2 个答案:

答案 0 :(得分:0)

如果您发表评论'下面的2行(通过在每行前面添加2个斜杠),它将阻止脚本重定向到另一页。

/* Redirect visitor to the thank you page */
//header('Location: http://address-of-confirmation-page.html');
//exit();

然后,您将有更多工作要做:

  1. 清除提交的信息
  2. 隐藏表单
  3. 显示感谢信息......
  4. 您需要显示代码以获得更多帮助。

答案 1 :(得分:0)

您可以使用ajax手动提交表单,并根据响应显示预期的消息。

您还应该注释上面的行以避免重定向。