GG资源网

无法从Contact Form 7表单发送WordPress外的POST值

问题描述:

my objective is to submit values via POST of a contact form 7 to a redirected outside php page and echo those values.

The issue is when the page is redirected after the submission, the values seem to be lost unless i remove the JS and change the action Url of the form ending up removing all the contact form 7 features which i require (validation, email sent, etc..).

I tried multiple plugins such as contact form 7 to API and it only works via GET method which i don\'t want. I tried to get the posted values and transforming them into session but it\'s not working because i\'m probably doing something wrong.

Here\'s the form:
enter image description here

Here\'s the result that is supose to be shown:
enter image description here

UPDATE:

Ok so i posted the function to fetch the posted data and the var_dump missing on the result php file.

Here\'s the fucntions.php

Here\'s the show-values.php

And here\'s the JS i put on the edit page of wordpress for redirection

The output is still missing:
enter image description here

Not using any extra plugin besides cf7 at the moment.

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~
功能建议

我的目标是通过联系表单7的POST将值提交到重定向的外部php页面并回显这些值。 </ p>

问题是在提交后重定向页面时,除非我删除JS并更改表单的操作Url,最后删除所有联系表单,否则值似乎丢失了 我需要的功能(验证,发送电子邮件等)。</ p>

我尝试了多个插件,例如联系表格7到API,它只能通过我不想要的GET方法工作 。 我试图获取发布的值并将它们转换为会话但它不起作用,因为我可能做错了。</ p>

这是表格:
在此处输入图像说明 </ p>

以下是显示的结果:\\ n 在此处输入图像说明 </ p>

更新:</ strong> </ p>

好的,所以我发布了获取发布数据的函数和结果php文件中缺少的var_dump。</ p>

这是fucntions.php </ p>

Put that in functions.php then in the spot you\'re calling your redirect code instead do:

That way it still has the post data in the first place, vs chaining redirects.

###

You can use Contact Form 7 hook for this.

try this:

See all the hooks provided by Contact Form 7

Update:
As you updated the question. for your case you can try this:
You can send values via query string via url or by creating a session variable.

Add this code in functions.php

now no need to redirect via js

in your show-values.php file add the following code.

However, another way is by creating a SESSION variable.

###

The other answer here is basically right, it just assumes you know how wordpress works. There\'s a file called functions.php that\'s generally where you want to to add any php code to w\\e your doing. How to interact with it is a two part thing, first you declare a function like normal:

Then you declare a trigger that calls the function:

In that trigger the contact form plugin allows you to hook into it so you can fire something, in this case, before that plugins core functions occur. Basically that line says, before doing the contact form stuff, run function \\\"what_I_wanna_do\\\". Put all the stuff you want to happen in what_I_wanna_do, then exitedirect however you want at the end. You can declare all these things in functions.php (or make your own plugin so it\'s easier to drop in and out of the code\\update WP).

由于网站搬家,部分链接失效,如无法下载,请联系站长!谢谢支持!
1. 带 [亲测] 说明源码已经被站长亲测过!
2. 下载后的源码请在24小时内删除,仅供学习用途!
3. 分享目的仅供大家学习和交流,请不要用于商业用途!
4. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
5. 本站所有资源来源于站长上传和网络,如有侵权请邮件联系站长!
6. 没带 [亲测] 代表站长时间紧促,站长会保持每天更新 [亲测] 源码 !
7. 盗版ripro用户购买ripro美化无担保,若设置不成功/不生效我们不支持退款!
8. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
9. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
10.如果您购买了某个产品,而我们还没来得及更新,请联系站长或留言催更,谢谢理解 !
GG资源网 » 无法从Contact Form 7表单发送WordPress外的POST值

发表回复

CAPTCHAis initialing...