Determining Fields of Information
Before you actually start writing code, it would be a good idea to figure out what information fields you want to store about the visitors. The obvious information comes to mind first: name, title, company, address, phone number(s), fax number, e-mail address. There may be others that are specific to your business. Let's also include these for this example: How did you hear about us? What products are you interested in? Comments/feedback.
Determining Fields of Information
Before you actually start writing code, it would be a good idea to figure out what information fields you want to store about the visitors. The obvious information comes to mind first: name, title, company, address, phone number(s), fax number, e-mail address. There may be others that are specific to your business. Let's also include these for this example: How did you hear about us? What products are you interested in? Comments/feedback.
Setting Up the Database
A very important piece of work in the initial design is deciding on how you will store the data. For simplicity's sake this example stores the information in a plain text file, with fields separated by a delimiting set of characters. There's no reason why you couldn't store the information into a relational or object database. There are several modules available that address the need of connecting Perl to relational databases. If you are interested in this capability, search the CPAN for ODBC modules.
In this example, you define one row in a file to be a single visitor. Our delimiting characters will be <*>
. Therefore, the database would be structured like the following:
Name<*>Title<*>Company<*>Address<*>City<*>State<*>Zip<*>Phone<*>Fax<*> Âe-mail<*> How<*>What<*>Comments
You'll define a distinct set of values for How
and What
. For example, How
might include Friend
, Magazine
, Salesperson
, Newspaper
, and Television
. You would define What
as an array of products that are in our product line.