I have used dreamweaver for my sins for developing, and this has enabled me to learn some structure very quickly, however - I sense at times that the coding is lazy, and only sticks in what is necessary.
The site I am developing just now has two levels of user that can login. ADMIN and CLIENT.
At the top of each page, I have the necessary
if (!isset($_SESSION)) {
session_start();
}
however, I have just installed PHP5 (as part of WAMP), and when I view my index page now, I get an "undefined index" error. This relates to the follwing line of code
if ($_SESSION['logged_in'] == TRUE)
now when a user first visits the site, all the session variable are going to be empty, so this index is always going to be "undefined".
I have done a search for "undefined+index+session+variable" but this hasn't really helped me here.
There is something basic that I have completely overlooked.
Is it necessary to declare all session variables BEFORE they are used? becuase in the above line of code in the index.php page, $_SESSION['logged_in'] would never be available to someone first visiting the site.