On Mon, 12 Aug 2002 16:10:59 -0500, [EMAIL PROTECTED] (Mariusz) wrote: >hi everyone. I'm putting a simple shopping cart together that emails order on the >checkout. Below is the logic of how it works and I was wondering if something could >be simplified (especially the number of pre existing conditions for the whole thing >to work, which are: user must accept cookies and run JavaScript)? > >1. script sets a cookie (if it doesn't exist yet) with a random 5 digit number as a >value - $value >2. opens a file (or creates one if it doesn't exist) with the name - $filename = >f.$value >3. writes the part number of the ordered item into the file
Figure out a way of doing it without javascript. You will be happier in the long run. Just let your cgi send out a page asking what they want to do. Get used to the idea of the cgi sending out a page and getting a form response back. For your example, you could put out a page which prints a link to your homepage(labeled exit), and a link back to your cart script (labeled continue). >4. at the same time JavaScript opens a window asking: "continue shopping or >checkout?" (this is a part I don't like since there is no connection between the cgi >script and this message - it pops up regardless if the script did its job or if there >were errors. Maybe I should place the JavaScript at the end of the perl script in the >HTML tags and execute only after the script runs successfully?) >5. if "continue" the pop-up message will simply close, if "checkout": >checkout.cgi will read the value of the cookie, open the f$value file and send its >contents back to the browser asking for the rest of the data (name, phone, etc..) and >email everything on submit. > >Thanks for any suggestions. This mlist is great and I'm amazed by everyone's >altruistic help. >Mariusz -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]