I use a Session ID to remember a user that's logged in on my site,
which works pretty well for the most part, because index.html sends
them to a page (index0.php) that starts the session and then sends
them on to index.php. However, this means that if someone goes
straight to one of the pages on my site that requires a Session ID to
allow them access to something, the page returns error strings at the
top, although it does proceed to display the rest of the page (so at
least it kind of works). I've tried just putting the session_start() ;
code right into the same page, but it then returns an error and won't
display the page at all. Is there any good way to start a session
within the same page (HTML or PHP) that I plan to locate the variable?
And just out out of curiousity, why doesn't it work to simply place
the session_start() ; code earlier in the code than the code to catch
the session variable?
Thanks in advance,
Jonathan
which works pretty well for the most part, because index.html sends
them to a page (index0.php) that starts the session and then sends
them on to index.php. However, this means that if someone goes
straight to one of the pages on my site that requires a Session ID to
allow them access to something, the page returns error strings at the
top, although it does proceed to display the rest of the page (so at
least it kind of works). I've tried just putting the session_start() ;
code right into the same page, but it then returns an error and won't
display the page at all. Is there any good way to start a session
within the same page (HTML or PHP) that I plan to locate the variable?
And just out out of curiousity, why doesn't it work to simply place
the session_start() ; code earlier in the code than the code to catch
the session variable?
Thanks in advance,
Jonathan
Comment