• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

5.1. Inserting Records

Inserting a new record into a database table is a two-step process. The first step involves creating a template with an input form that collects the information you want to insert. The second step in the process takes the form-field data and inserts it into the database table. The code for this process is generally broken up into two templates, but it is possible to use a single template (with conditional code, as described in Chapter 3) that posts to itself if you desire.

5.1.1. Inputting Data via Forms

The most popular method for collecting data to insert into a database is via an HTML form. When creating your input form, you should name your form fields the same as their equivalent database fields. This avoids any confusion when writing SQL statements or code that manipulates data.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint