0

I have a url:

domain.com/?city=newyork&postback=test

I am currently successfully passing the postback parameter using the PHP below. However, I can not figure out how to also pass the city parameter.

<?php session_start(); 

if(isset($_SESSION['postback'])) {
    if($_GET['postback'] == "") {
        header ("Location: qualify-step2.php?postback=".$_SESSION['postback']);
        }
    }

 ?>

Can someone please help me edit the code successfully? Any suggestions are greatly appreciated.

1
  • Use the superglobal $_GET for accessing those variables. This is pretty basic. Commented Jun 15, 2015 at 23:08

3 Answers 3

2

You should use the $_GET superglobal to get params from url... In your case $_GET['city'] holds the value newyork and $_GET['postback'] holds the value test.

Sign up to request clarification or add additional context in comments.

2 Comments

postback param is on session.
The url has the postdata param that holds value "test"
0

You mean like this

<?php session_start(); 

if(isset($_SESSION['postback'])) {
    if($_GET['postback'] == "") {
        header ("Location: qualify-step2.php?postback=".$_SESSION['postback']."&city=".$_SESSION['city']);
        }
    }

?>

3 Comments

Did you just add &city=".$_SESSION['city'] to the end of URL ? Why did you do that? your condition is if($_GET['postback'] == ""), it is mean, this parameter is null.
You're a good man with outstanding character. Good karma is headed your way my friend
I'm completely lost with this stuff, tried hacking with the code but I was missing the "." at the end of .$_SESSION['postback']
0

For geting parameter from URL, you should use $_GET['param'];.

Note: In here, You should use Get method for sending data.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.