Session Handeling

I am confused about sessions. Do you need to call session_start at the top of each individual php file or can session_start be called only on the main file which calls the other php files via include/require commands?

You need one session_start() statement on any page that sets or references a session variable. The only requirement is that it must come before any output is sent to the browser. It can be in the main code or in a common initialization/configuration file that you require into any page that needs it.

Great. Thanks. I was thinking of doing s session.php file to handle a session process

Sponsor our Newsletter | Privacy Policy | Terms of Service