Reputation: 1725
I am defining a session variable based on $_POST (from page 1) on page 2 off my application like this:
customer_view.php
<?php
session_start();
// Session Name//
$account_manager_id = $_POST["account_manager_id1"];
$_SESSION['account_manager_id'] = $account_manager_id;
// this sets variables in the session//
?>
and using it again on page three like this:
category_view.php
<?php
session_start();
$account_manager_id = $_SESSION['account_manager_id'];
// Session Name//
// this sets variables in the session//
?>
The $account_manager_id session variable passes from page to page and works as required in Chrome, but not in FireFox. The web console on page 3 is only showing the syntax errors being caused by the session variable being undefined in page 3.
Any thoughts?
ADDED code from page one as requested:
<form action="customer_view.php" method="post">
<p>Enter Account Manager ID</p>
<input type="text" name="account_manager_id1" id="account_manager_id1"/>
<input type="submit" value="submit" />
</form>
Upvotes: 1
Views: 1371
Reputation: 6887
You haven't define the variable in page 1 and you didn't use isset or empty to check the variable is SET or Empty
$account_manager_id = '';
if(isset($_POST['name']) $account_manager_id = $_POST["account_manager_id1"];
Upvotes: 2