简体   繁体   English

Wordpress联系表格7将POST vars传递给感谢页面

[英]Wordpress Contact Form 7 pass POST vars to thanks page

I am trying to use Contact Form 7 to redirect the user to a new page that thanks them and offers more info once the form has successfully been filled. 我正在尝试使用联系表单7将用户重定向到感谢他们的新页面,并在表单成功填写后提供更多信息。

How can I pass the $_POST[] vars through? 我如何通过$_POST[] vars? I couldn't find anything on Google. 我在谷歌上找不到任何东西。

Edit: 编辑:

I am also trying to use the form to pre-populate a PayPal buy it now button. 我也在尝试使用该表单预先填充PayPal立即购买按钮。

According to Contact Form 7 documentation you have to set a JavaScript action hook. 根据Contact Form 7 documentation您必须设置JavaScript操作挂钩。 By using this hook, you can specify a JavaScript code that you wish to run after the form is successfully submitted. 通过使用此挂钩,您可以指定在成功提交表单后要运行的JavaScript代码。 You will find the Additional Settings field at the bottom of the contact form management page. 您可以在联系表单管理页面的底部找到“附加设置”字段。 Simply insert the following line into it: 只需在其中插入以下行:

on_sent_ok: "your javascript code;"

If you want you can use following code to redirect to a new page with variables but it will send the variables to the $_GET 如果需要,可以使用以下代码重定向到包含变量的新页面,但它会将变量发送到$_GET

on_sent_ok: "location = 'http://yourdomain.com?myVar=somevalue';"

You can retrieve the variable as follows 您可以按如下方式检索变量

$myVar = $_GET['myVar'];

Read more , also check add_query_arg . 阅读更多内容 ,同时检查add_query_arg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM