- Sep 23, 2003
- 11,449
- 264
- 126
So I'm trying to use sessions for a shopping cart (if you know a better way please enlighten me) so all the users are indexed by the session ID.
The general flow of my code is the following:
<!Document declaration
<html ... >
2 meta tags
then we get into the body. This is the standard layout for EVERY page. Once I get into the body I set the variable $headerfile and then include('header.php');
No matter where I put <?php session_start(); ?>, either at the beginning of the index file or at the beginning of the header file, I get an error that session_start() has already been called. When I put it at the beginning of index.php, it states that line 1 of index.php is the line that already called it... well gee thanks!
Any ideas? Either I need to figure this out or abolish session_id's as a way to do my shopping cart. I wanted to avoid cookies, but even if I used cookies, how do I know which user has what items without a session ID?
Thanks for any help!
The general flow of my code is the following:
<!Document declaration
<html ... >
2 meta tags
then we get into the body. This is the standard layout for EVERY page. Once I get into the body I set the variable $headerfile and then include('header.php');
No matter where I put <?php session_start(); ?>, either at the beginning of the index file or at the beginning of the header file, I get an error that session_start() has already been called. When I put it at the beginning of index.php, it states that line 1 of index.php is the line that already called it... well gee thanks!
Any ideas? Either I need to figure this out or abolish session_id's as a way to do my shopping cart. I wanted to avoid cookies, but even if I used cookies, how do I know which user has what items without a session ID?
Thanks for any help!