如何通过 php 标头重定向传递 GET 字符串中收到的变量?

2022-01-11 00:00:00 variables header get php

在用户提交表单后,我从 Aweber 接收 GET 字符串中的值.我获取他们发送的变量并将它们提交到 SMS 网关,以通过短信通知第 3 方提交.

I'm receiving values in a GET string from Aweber upon user's submission of a form. I take the variables they send and submit them to a SMS gateway to notify a 3rd party of the submission by text message.

这是我的问题.我需要将在 php 标头中执行传出 SMS 命令的页面重定向到另一个页面,该页面最终显示从 Aweber 发送的 GET 变量.

Here's my problem. I need to redirect the page that performs the outgoing SMS commands in a php header to another page that finally displays the GET variables sent from Aweber.

我可以在第一页检索变量及其值.如何将它们传递到第二页?

I can retrieve the variables and their values in the first page. How do I pass them to the second page?

这是我在第一页 (sms.php) 上用来收集 Aweber 发送的变量的代码:

Here is the code I'm using on the first page (sms.php) to collect the variables sent by Aweber:

   $fname   = $_GET['name'];
   $femail  = $_GET['email'];
   $fphone  = $_GET['telephone'];
   ....etc

   header('Location: confirmed.php');
   exit;

推荐答案

session_start();
$_SESSION['fname']   = $_GET['name'];
$_SESSION['femail']  = $_GET['email'];
$_SESSION['fphone']  = $_GET['telephone'];
....etc

header('Location: confirmed.php');

然后在下一页获取它,例如:

and get it on the next page like:

session_start();
$fname   = $_SESSION['fname'];
$femail  = $_SESSION['femail'];
$fphone  = $_SESSION['fphone'];

....等

相关文章