Perl/CGI - Handling Sequential Forms - Buying Process

They have: 1 posts

Joined: Sep 2005

Hi,

here is my problem. Right now I am creating a website where people will buy a product or service and the whole buying process happens with the customer going through several forms before finally committing to his choices and giving his credit card information for verification and final purchase.

How do I handle this properly?

- Should I do it using cookies? If so how?
or
- Should I save the information from each form in a text file? If so how?

In either case, how do I handle a customer going back and forth between the different forms? A few guidelines would be greatly appreciate.

Last question; is there anything already existing that would save me from reinventing the wheel? Any Perl script or Perl library that already does that?

Thanks,
Micheal T
P.S. I am using Perl because I know Perl, no other particular reason.

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

I recommend saving a session id in a cookie, then in your Perl program pull that in to look up their information in a database like MySQL.

When they start the whole forms process, you can create a record for them if there's not already one for their session id, then each time they load a form page, check if there's already data for that page in the database. If there is, pre-fill the form with it, and if not, don't.

Once they've finished the process, kill the cookie.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.