联系表格,包括前一页的引荐 [英] contact form including referral of previous page

查看:70
本文介绍了联系表格,包括前一页的引荐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用POST的php联系人表单,我想自动在表单上包含引荐页,即指向该联系人表单的网站.这通常会在我的网站内.

I have a php contact form using POST and I want to automatically include the referring page on the form, that is the website linking to the contact form. This would normally be within my website.

例如,

www.website.com/nothere.php 退货 404.php(以www.website.com/nothere.php作为地址)

www.website.com/nothere.php returns 404.php (with www.website.com/nothere.php as the address)

在404页上,我有一个指向contact.php的链接,这是一种联系表格.

on the 404 page I have a link to feedback.php which is a contact form.

我希望在提交的表单中包含引用URL(在本例中为"www.website.com/nothere.php").

I want the referring URL (in this case "www.website.com/nothere.php") included on the submitted form.

我知道我可以使用以下代码:

I understand I can use this code:

$ref = getenv("HTTP_REFERER");

因此,我将其添加到了页面顶部的php中(这是一个代码段):

So, I added that to the php at the top of the page (here is a snippet):

$SendTo = "web@website.com";
$Subject = "Website Feedback";
$FromString = "From: ".$_POST['eaddress']."\r\n";
$ref = getenv("HTTP_REFERER");

但是我该如何编码居留权,以便将推荐人打印在电子邮件上?

But how do I code the indhold so the referral is printed on the email?

$Indhold .= "Referring page: ".$_POST['$????']."\n";

有人可以帮忙我需要添加到上面的行吗?还是我需要以其他方式解决这个问题?

Can someone help with what I need to add to the above line? Or do I need to go about this in a different way?

非常感谢! 安迪

推荐答案

将一个隐藏的输入字段放入您的联系表单中,该表单包含引荐来源网址:

Put a hidden input field into your contact form, that contains the referer:

<form ...>
...
<input type="hidden" value="<?php echo $_SERVER['HTTP_REFERER'] ?>" name="referer" />
...
</form>

然后,您可以在发送电子邮件时使用$_POST['referer']进行访问.

Then you can access it with $_POST['referer'] when sending the email.

这篇关于联系表格,包括前一页的引荐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆