How are you creating this shopping basket then... if you were using cookies this problem wouldn't exist, so I'm guessing your not using cookies, and if you were using php sessions then this also wouldn't happen, so you musn't be using them, at least not correctly. Are you storing all the basket items for all users in the same database (or text file?), I hope not because this would cause all kinds of problems.
I would suggest using php sessions, this way the standard session handlers will keep track of all items in the cart and when the session is destroyed (either when the user says destroy or the max time is reached) the items will also disapear from the cart... I suggest looking at the sessions section of the php manual, if you have trouble understanding just ask again and I will be more than happy to assist 🙂
If you're looking for a non-session/non-cookie methood than you might want to look into using a database to store items that each individual user selects, you could then associate these items based on a users IP or even better a random hash value (MD5) based of their ip and something random like the current time that you could pass through the url of each page. Neither of these methoods would need the user to login in any way 🙂
Anyways as I said if ya need help thats what I'm here for 🙂