php login script Undefined variable: _session script

后端 未结 2 1158
猫巷女王i
猫巷女王i 2021-01-22 16:24

i am trying to have a login script burt i have this error Undefined variable: _session see below the pages

//checklogin.php



        
相关标签:
2条回答
  • 2021-01-22 16:36

    It is $_SESSION not $_session you also need to add session_start() on top of the page

    FROM PHP DOC

    Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.

    0 讨论(0)
  • 2021-01-22 16:49

    $_SESSION is to be written capitalized. In your code it is all lower case:

    if(!$_session['name']= myusername){
    

    change to (also add the $ to myusername):

    if(!$_SESSION['name']= $myusername){
    
    0 讨论(0)
提交回复
热议问题