I have a single HTML page that uses a carousel style log in system. Each step in the sign up works off of a different php script. There are 3 forms on the page that appear as the user progresses through the sign up. As they progress I need to keep their user id from the first step in a variable in order to update parts of their account later on.
The forms are executed via ajax and the first php script calls
session_start();
And then sets the session variable
$_SESSION['user_id']=$account_id;
As I progress through the form I put this at the top to check if the session variable was passing through
if (empty ($_SESSION['user_id'])) {
$message = 'Cant find the session id';}
And it is not. I don't have session_start() at the top of the other php scripts.
Am I misunderstanding how to pass this variable?
I don't have session_start() at the top of the other php scripts.You answered it yourself, if you don't have it initiated how do you expect it to work? By callingsession_start()at the top of your script you're allowing it to read the session that has been previously saved from another step of your code.