Undefined variable: _SESSION when sending variables via post through JavaScript trigger

前端 未结 8 492
执念已碎
执念已碎 2020-12-14 15:49

In my index.php file I call session_start() and set a couple of session variables. In a second PHP file I would like to access these session variables.

8条回答
  •  执念已碎
    2020-12-14 16:25

    session_start() is the answer. And here's one more way of going about it:

    
    

    This will ensure that a new session is started only if you do not have a current session on already. And ofcourse, as others have said, make sure to place this at the top of the html.

提交回复
热议问题