Reputation: 987
On my index page, I have a drop down list that, when clicked, sends the result via POST to the next page. The next page converts one of the POST variables to a SESSION variable. This is the code:
$_SESSION['land']=$_POST['land'];
From this page though, I send a POST request to a cart page, which then does the job and goes automatically back to the previous page. The code for this is
header('Location: '.$page);
The problem is that when this page goes back to the previous one, the SESSION variable cannot be loaded because there is no POST request. How can I go about making sure no error that comes up?
Any tips and code would be great Thanks
Upvotes: 0
Views: 150
Reputation: 2872
Assuming they click a link that takes them back to this page:
if(isset($_POST['land']) && !empty($_POST['land'])){ $_SESSION['land']=$_POST['land']; }
Upvotes: 2