user1322707 user1322707 - 7 months ago 25
PHP Question

How to pass variables received in GET string through a php header redirect?

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;

Answer
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

Comments