Jump to content

Shopping cart tutorial quantity won't go up start session problem


slam38

Recommended Posts

As mcChris said, this error often means you accidentally have an extra space before the session_start() function. I would check that those files above don't have any blank lines/spaces before the opening <?php tag, or possibly any blank lines / spaces after the closing ?> tag in templates.php.

 

As a sidenote, although the shopping cart tutorial doesn't go into this, it is sometimes a php best practice to leave out the closing PHP tag ("?>") in PHP pages -- it really isn't necessary. (This only applies to pages that are fully PHP, and include no html. You could drop the closing PHP tag on all three PHP pages above.) It's quite easy for extra spaces to end up on the end of a file, and if you're using several includes, tracking these spaces down can be a pain, especially if you're dealing with lots of files. Spaces after closing PHP tags is known to cause various issues including invalid headers like you are encountering...

Link to comment
Share on other sites

Thankyou Falfencreate, and McChris,

 

for getting back to me I will try what you have suggested. Just as an after thought is there a specific way to find and get rid of the white space or do I just do through the file and delete where I think it might be?

 

Thanks again.

Link to comment
Share on other sites

i uploaded my 'magic cart' to my web server for further testing and ran into this 'headers already sent' issue myself...

 

after following falkencreative's solutions the issue didn't resolve...then i found this: http://www.phpbuilder.com/board/showthread.php?t=10310794 ...post #8 was what caused my headers to be sent...there are other ideas there too...

Edited by mcChris
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...