如何获取表单消息中的上一个URL [英] How to get the previous URL in Form message
问题描述
我正在WordPress网站上创建一个联系表单
.
I am working on a WordPress site, where I have created a Contact Form
.
因此,只要有人点击应用
进行招聘广告,就会带他们到联系表格
So whenever someone clicks to apply
for a job advert it takes them to a Contact Form
示例网站- https://www.inext.se/job/solution-architect/
应用程序联系表- https://www.inext.se/job-apply-form/?id = 6770
现在我要获取的是上一个URL主题/标题
或上一个URL
.
在JavaScript中,我知道可以通过-
In JavaScript, I know it is possible to get it by -
<script type="text/javascript">
document.write(document.referrer);
</script>
但是我在任何地方都找不到如何以 mail
message body
的形式获得.
But I didn't find anywhere how to get in a form mail
message body
.
我尝试使用-
[_url]
[_post_name]
[_post_title]
但这给了我不必要的表单URL.
But this gives me the form URL which is useless for me.
有人知道任何解决方案吗!
Do anyone know any solution!
推荐答案
我认为最好的方法是在要离开的页面的URL中添加一个参数.这样做将使用户使用一个额外的GET参数进入新页面,该参数可以是您的标题/网址.
I think your best shot is to add a parameter in the URL from the page you are leaving. Doing that will bring the user to the new page with an extra GET parameter that can be your title/url.
With Cf7 you have a very ugly way to do that which is described here: https://contactform7.com/getting-default-values-from-the-context/
只要您的cf7表单项名称等于GET参数名称,就可以使用.不好的是,您没有预处理能力,需要直接在URL中传递值,而无需任何编码(至少从我所知)
As long as your cf7 form item name equals the GET parameter name, you are good to go. The bad thing about this is that you have no pre-processing power and you need to pass values directly in the URL, w/o any encode (that's from what i know at least)
这篇关于如何获取表单消息中的上一个URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!