How to Pass Variables Received in Get String Through a PHP Header Redirect

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

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

Passing variables received in GET string through a php header redirect?

try to print the token and userid in the same page. The code you wrote above is correct, and try to get the variable on other page as $_REQUEST['code'] and $_REQUEST['id']

Passing emails in PHP header redirect - strips @ ?

You need to encode that URL properly. You're currently not sending a valid URL.

header('Location: http://surveyprovider.com/surveyID/start?email=' . urlencode($email)); 

The @ becomes %40:

http://surveyprovider.com/surveyID/start?email=test%40example.com

http://php.net/manual/en/function.urlencode.php

passing php variables through header

You are using single quotes ' which will make it a literal string, instead, concatenate that using a . instead

redirect_to('member_profile.php?id='.$mselcted_memberI);

Also, you don't require braces {} here

header("Location:$location");

PHP passing a variable with header redirect

You need to use urlencode like this:

if($name != "lopan"){
header("Location:error-page.php?errorMssg=".urlencode("Waoo so your not EVEN going to try to enter information huh?"));
}

And in error-page.php, you should get it (no need to urldecode):

<?php
$errorMssg = $_GET['errorMssg'];

PHP Header Redirect with parameter

For send variable

$user = 'test';
Header("Location: query.php?user=".$user);

For receive the value of user variable

$user = $_REQUEST['user'];

I hope it will help to resolve your problem.

Redirect php using header location and passing parameters

May be you can use usual $_GET to get the params from URL string? And then in php you can do anything you want.
Like:
http://domain.com/file.php?param1={param1}¶m2={param2}¶m3={param3}¶m4={param4}

in file.php:

$param1 = $_GET['param1'];

$param2 = $_GET['param2'];

and etc.
Then you can set header function with needed options
Hope that helps you



Related Topics



Leave a reply



Submit