我有这个
session_start();
if ($_SESSION['email']&&$_SESSION['companyID'])
echo $_SESSION['email']."";
else
die("You must be logged in!");
现在我在数据库中保存了一些数据,我想通过使用包含这些但不保存companyID的createUser.php来保存companyID
$userID=0;
$userRole=$_POST ["role"];
$userEmail = $_POST["userEmail"];
$userPassword = $_POST["userPassword"];
$companyID = $_POST[$_SESSION["companyID"]];
//插入到user_details表
$sql = "INSERT INTO users (userID, email, password,companyID,roleID) VALUES
('$userID', '$userEmail', '$userPassword','$companyID','$userRole')";
答案 0 :(得分:1)
尝试替换它:
$companyID = $_POST[$_SESSION["companyID"]];
为此:
$companyID = $_SESSION["companyID"];