- Creating and Sending eGreetings
- Preparing to Work
- Working with the Card Template
- Applying the Scrollbar
- Customizing the Scrollbar
- The eGreeting Interface
- Defining the Structure of the Database
- Using the LoadVars Object to Send Data
- Error Checking
- Setting Up and Testing the Email Program
- Displaying the Card for the Recipient
- Putting It All Together
Defining the Structure of the Database
In this example, I used a Microsoft Access database with the structure shown here. MySQL or any other database suitable for web applications could be used instead. If you have Access installed, open greetings.mdb. Click Design, and you should see the same structure as pictured.
Only one database table is needed for this project, cardInfo. Each eCard is stored in the table as a single record. Each record in cardInfo contains a unique msgID field. The msgID is set up as an AutoNumber data type, which guarantees a unique msgID value for each new record you insert. Having a unique value makes it possible for you to find any given card and pull all of its information to display when a recipient wants to view it.
Figure 10.6. The structure of the Access table used to store card information.All other fields in the table are text fields. The remaining fields store the recipient's name and email address and the sender's name and email address. Retaining sender information makes it possible for the recipient to reply, perhaps to thank the sender for his or her thoughtful message.