Reputation: 13
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.
Upvotes: 0
Views: 120
Reputation: 165
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.
Upvotes: 2
Reputation: 4185
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']);
}
}
?>
Upvotes: 0
Reputation:
For geting parameter from URL, you should use $_GET['param'];
.
Note: In here, You should use Get method for sending data.
Upvotes: 0