Hi, I am confused about how sessions work in PHP. Here is what I am confused about exactly:
I have a login page and then a dashboard page.
At the start of every page I do:
`session_start()
Also, my code works like this:
After the username and password were entered they get verified and if correct I do:
`$_SESSION[‘username’] = $username;
?>
<script type=”text/javascript”>
window.location = ‘../../../dashboard.php’
</script>
<?php
`
The problem I am facing is that at the dashboard.php page right after I do `session_start()`print_r($_SESSION)
I tried refreshing the page cash and it didn’t help. Also, I tried putting `print_r($_SESSION)
What am I doing wrong? Why does the $_SESSION get errase after swapping the pages?
Thank you!