HTML PHP Display username after success login

后端 未结 8 1602
执念已碎
执念已碎 2020-12-06 03:15

I have a

inside my onlinestore.html file which is my menu that contain of Login/Register. What I want is after the success login, the
8条回答
  •  难免孤独
    2020-12-06 03:30

    In your else statement you haven't defined a session_start() like you did in your if statement.

    And else, instead of checking the value of a $_SESSION and determining the value of it, you can use the following:

    if (session_status() == PHP_SESSION_NONE) {
    //Do something if the session is not existing
    }
    

    Other options are storing variables in a $_COOKIE and then check if it isset or not(if(isset($_COOKIE["username"]){})

    I hope this has helped you out

提交回复
热议问题