shopping cart question
| From: | Jon Feldhammer | Date: | Sat, 02 Mar 2002 02:40:36 +0000 |
| Subject: | shopping cart question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-86877@lists.php.net to get a copy of this message | ||
The way I see it, there are three options for maintaining state in php.
I've already taken the route of keeping a random session id and putting it
into a database to track a user/cart. So the only variable i need to track
is the session id. The three options I know of then are:
1. Putting the session id in the url
2. Putting the session id into a cookie
3. Putting the session id into a hidden input type and have every button be
a form
Option 3 sucks asthetically and coding wise. Option 1 is somewhat ugly
because now you have a big ole session id in your url (plus I don't think
search engines like these). Also, with option 1 you need to have a <?php
echo "?session_id=$session_id" ?> type line in every href which is a pain in
the ass. Option 2 is great, if the user uses cookies, if not, you cannot
track the user at all. Anyone have the perfect solution?
Thanks.
Jon