-1

I'm making a simple registration/login form using PHP linked to a MySQL database. However when creating the login session, despite the user login details being verified correctly, whenever the session is being verified using the username session variable it is always returning false and when I check the session variable contents using print_r it shows that it contains nothing.

Here is a picture of my login code and the session verification code: https://i.stack.imgur.com/q8WSY.png

Thanks for any help.

Waypalm
  • 13
  • 1

1 Answers1

1

You need to start your session by adding session_start() above $_SESSION['username'] = $row['username']; in login.php.

The Codesee
  • 3,714
  • 5
  • 38
  • 78