Cookies in a form ...
Results 1 to 5 of 5

Thread: Cookies in a form ...

  1. #1
    Registered User
    Join Date
    Nov 2000
    Location
    Palm Beach, FL.
    Posts
    77

    Question Cookies in a form ...

    Hi:

    I have a situation were I should use cookies in a form. If any of you is cookies literate, your input will be greatly aprreciated it.

    Here is the situation ...

    Online catalog, containing over 100 pages of data in forms. Average 30 items per page.

    Each page in the catalog contains an average of 30 items that each item includes an item number, description, price and an empty value imput box for quantity required.

    I know cookies have limitations in how many you can use per server. So my idea is to have one cookie per page that has multiple values. Values that sends all items described avobe. And have an order form, at the end, where all the cookies that are not null, will be called and processed.

    If anyone have a better idea, I am open to them as well. Thankx in advance
    The objective it is not to die for your country, but to make the other bastard die for his.

  2. #2
    Registered User
    Join Date
    Jan 1999
    Location
    London, Great Britain
    Posts
    300

    Lightbulb

    What language are you writing this in? The reason I ask is that if you have server-side scripting ability, you would be better off saving your customer's shopping cart into a database with a unique reference, and then setting a cookie with this unique reference key. That way you are not limited to the number/size of cookies.

    Amazon (who have one of the best shopping carts, IMHO) use this technique. They set a cookie once you have logged in, so they know who you are on each page. This also means that if you go to Amazon from a different computer and you login, you still see the same shopping cart - a cookie based one would be specific to that computer. Don't forget that cookies expire as well, so your user may lose the entire contents of their cart!

    If you don't have the ability to do this, you should simply concatenate the unique product ids together with a seperator. When you come to the checkout, you can simply split your list of item ids and then step through each one to create your order form.

    HTH,
    I'd rather die peacefully in my sleep like my Grandfather,
    than screaming in terror like his passengers.
    Jim Harkins
    <a href="http://www.Horrible.Demon.co.uk/" target="_blank">http://www.Horrible.Demon.co.uk/</a>

  3. #3
    Registered User
    Join Date
    Nov 2000
    Location
    Palm Beach, FL.
    Posts
    77

    Question

    Thankx for your reply I am writing this site in HTML and Java. I was thinking about writing the cookies in either Java or PHP because it is a Unix server. I dont want to deal with a database like MySQL because I have made 90% of the pages already.

    Here is the URL so you can have an idea of what I am trying to accomplish ... <a href="http://www.promosurdiscos.com/cumbia1.htm" target="_blank">http://www.promosurdiscos.com/cumbia1.htm</a> ... thankx again
    The objective it is not to die for your country, but to make the other bastard die for his.

  4. #4
    Registered User
    Join Date
    Jan 1999
    Location
    London, Great Britain
    Posts
    300

    Lightbulb

    PHP can handle cookies (and sessions) very easily, so it would be quite simple to convert any existing code to use it.

    PHP also has a very easy interface into MySQL database, so again taking your existing code and converting it to use a database should be a trivial exercise and also good experience.

    The thing to remember is that using a database gives you far greater flexibility (ie, one code page to handle all the pages in your site store) and scalability (you would be able to have many thousands (millions?) of items in your store database) compared to using a cookie/html based solution - maybe this is a longer term goal rather than the short term of getting it working.

    There's plenty of free PHP shopping cart scripts available off the net to use, base your own on, or simply pull apart to see how they work. A quick search with <a href="http://www.google.com/search?q=php+free+shopping+cart+system" target="_blank">Google</a> (search: php free shopping cart system) gives plenty of results.

    Just a quick critique of your link:

    The page looks very nice (nice graphics and colours) and the layout is very good.

    If I wanted to search for an item by a artist name or title, I currently couldn't do it as you can only search for words. If you had a database, searching would be very easy on specific things like title, artist, price, genre, etc. This may put customers off if they've come to your site to buy a certain item. The search isn't particularly helpful either - I was expecting a list of CDs to come up rather than the pages they are on, so I'm still having to look through pages rather than directly finding the item I searched for.

    When you select some items then click the next page links, it loses all the items I have selected. This is because you are not "remembering" the items I selected when you go to a different page. This means you're losing the customer's items and would probably mean people getting frustrated with your system and using a different site.

    How are you going to update your list of items? If you are editing an HTML file, it will be a real pain and you would find it very difficult to "sell on" this system to a site owner as they would require some knowledge of editing HTML to update their pages. Again, if you used a database you could write a nice update page that would allow the site owner to easily update their stock without learning HTML - after all, if they have to learn HTML, why are they going to bother buying a site from you?!

    Sorry to sound negative but these are a few things that you need to consider! The site looks excellent though - good luck with it!

    HTH,
    I'd rather die peacefully in my sleep like my Grandfather,
    than screaming in terror like his passengers.
    Jim Harkins
    <a href="http://www.Horrible.Demon.co.uk/" target="_blank">http://www.Horrible.Demon.co.uk/</a>

  5. #5
    Registered User
    Join Date
    Mar 2001
    Posts
    592

    Post

    First I'd like to say that the limit is 25 cookies per site.
    Expiration time is not a issue since you are the one setting the time limit and you can set it to a year.

    What you can do is,
    Each time a user log in a record is created for him on the server.
    The server records are what keeping track of the user's orders / Actions.
    The Cookie is only used for knowing who the user is and retriving/updating the correct records.
    If you are into Video Editing : <a href="http://www.highvid.com" target="_blank">www.HighVid.com</a>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •