保存“电子邮件”的会话由于 form.php 未传递到确认页面
这是我的过程。 我已在每个页面上附加了一个链接,以便您可以看到确切的代码,因为它很重要。 我无法解决这个问题。
page.php(表单所在的位置,位于页面底部)
form.php(在其中处理此表单和其他表单,并将数据保存到 CRM 中)
confirmation.php (其中 page.php 在 POST 提交后重定向)
基本上我在 page.php 上有一个表单,该表单将 POSTS 发送到form.php,其中数据保存到 CRM 脚本中,然后重定向到confirmation.php。
我需要将“电子邮件”值传递到confirmation.php 我所做的是在 form.php 上使用会话来保存电子邮件值,然后在确认时回显它。请检查上面的代码以了解如何操作。
但结果呢?它不起作用,电子邮件没有在确认.php 上得到回显
有什么想法吗?
上面代码的重要部分(在我看来):
在最顶部的 form.php 上:
<?php
session_start();
$_SESSION['contact'] = $_POST['email'];
?>
<?php
在最顶部的confimation.php 上:
<?php
session_start();
?>
<?php
在confirmation.php 上,然后我回显它:
<?php echo $_SESSION['contact']; ?>
但它不起作用。
This is my process.
Ive attached a link to each page so you can see the exact code since its important.
I cant solve this problem.
page.php (where the form resides on, its at the bottom of the page)
form.php (where the this form and others are processed and the data is saved into the CRM)
confirmation.php (where page.php redirects on after POST submit)
Basically i have a form on page.php that form POSTS to form.php where the data is saved into a CRM script and then redirects to confirmation.php.
I need to pass the "email" value onto confirmation.php
What i did was i used a session on form.php to save the email value and then echo it on confirmation. Please check the code above to see how.
But the result? Its not working, the email is not being echoed on confirmation.php
Any ideas?
Importants part of the codes above (in my opinion):
On form.php at the very top:
<?php
session_start();
$_SESSION['contact'] = $_POST['email'];
?>
<?php
On confimation.php at the very top:
<?php
session_start();
?>
<?php
on confirmation.php i then echo it:
<?php echo $_SESSION['contact']; ?>
But its not working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将电子邮件地址添加到感谢 URL 的查询字符串中即可。
假设感谢 URL 的查询字符串中还没有变量,那么您所要做的就是:
在 form.php 中,将其更改为:
对此:
如果 URL 中已经存在变量,那么您需要附加行如下所示,用 & 符号代替问号:
Just add the email address to the query string for the thank you URL.
Assuming the thank you URL doesn't already have variables in the query string, then this is all you have to do:
In form.php, change this:
To this:
If there's already variables in the URL, then you'd want the additional line to look like this, with an ampersand instead of a question mark: