如何通过PHP头重定向传递GET字符串中收到的变量? [英] How to pass variables received in GET string through a php header redirect?

查看:81
本文介绍了如何通过PHP头重定向传递GET字符串中收到的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用户提交表单时,我从Aweber的GET字符串中接收值。我将他们发送的变量提交给SMS网关,通过短信通知第三方。



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



我可以检索变量并他们的价值在第一页。如何将它们传递到第二页?



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

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

header('Location:confirmed.php');
出口;


解决方案

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

header('Location:confirmed.php');

并在下一页显示:

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

.... etc

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.

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?

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'];

....etc

这篇关于如何通过PHP头重定向传递GET字符串中收到的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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