Reputation: 33
I have this
session_start();
if ($_SESSION['email']&&$_SESSION['companyID'])
echo $_SESSION['email']."";
else
die("You must be logged in!");
and now im saving some data in database, and i want to save the companyID aswell by using createUser.php which contain these but its not saving the companyID
$userID=0;
$userRole=$_POST ["role"];
$userEmail = $_POST["userEmail"];
$userPassword = $_POST["userPassword"];
$companyID = $_POST[$_SESSION["companyID"]];
// insertion to user_details table
$sql = "INSERT INTO users (userID, email, password,companyID,roleID) VALUES
('$userID', '$userEmail', '$userPassword','$companyID','$userRole')";
Upvotes: 0
Views: 39
Reputation: 2167
Try replacing this:
$companyID = $_POST[$_SESSION["companyID"]];
For this:
$companyID = $_SESSION["companyID"];
Upvotes: 1