Nevermind I fixed it now. I realized that it is the same session, but the problem was with session locking. I had to start_session, change variable and then session_write_close