The mgiDatabaseSubmit Tag
Tag Behavior
The mgiDatabaseSubmit tag adds records to a database from
a form submission. This tag allows information to be added to
a database without full administrative control of the database.
Tag Syntax
The mgiDatabaseSubmit tag has two required parameters and
no optional parameters. The tag form is:
<mgiDatabaseSubmit databaseFileLocation="File Path"
tableName="Table Name">
Required Parameters:
- databaseFileLocation="File Path" where "File
Path" is the relative path to the database file where records
are added.
- tableName="Table Name" where "Table
Name" is the name of the database table where records are
added. The table name is case-sensitive.
Optional Parameters:
Submitting Records:
- To submit information to a database, create a form and name
any form fields (e.g. text fields, text boxes, radio buttons,
checkboxes, etc.) that will be submitted to the database with
the following syntax:
name="field=DatabaseFieldName"
- The database field names are case-sensitive. You may choose
to add any or all database fields with the form. The action of
the form should be the name of the return page containing the
mgiDatabaseSubmit tag and the method should be "post".
- Submissions with Page Variables: On the return page
(that contains the mgiDatabaseSubmit tag), you can use a page
variable(s) to enter information in a database field. To submit
information to a database field with a variable, enter a page
variable in the HTML above the mgiDatabaseSubmit tag. Name the
page variable with the syntax name="field=DatabaseFieldName".
You can use multiple page variables to submit information to
multiple database fields. Note: you cannot submit information
to the database with a form field (post argument) AND a page
variable with the same name. For example, to submit the current
date to the "Creation Date" database field, enter the
following page variable above the mgiDatabaseSubmit tag:
<mgiSet name="field=Creation Date">
<mgiDate>
</mgiSet>
Example Usage and Output
On the form page, each field is named with the name="field=DatabaseFieldName"
syntax. In addition, the form action points to the page containing
the mgiDatabaseSubmit tag (return.html).
<FORM ACTION="return.html" METHOD="POST">
<H3 ALIGN=CENTER>Request Information</H3>
First Name: <INPUT NAME="field=FirstName" TYPE="text" SIZE="30">
Last Name: <INPUT NAME="field="LastName" TYPE="text" SIZE="30">
Address: <INPUT NAME="field=Address" TYPE="text" SIZE="30">
Phone: <INPUT NAME="field=Phone" TYPE="text" SIZE="30">
Email: <INPUT NAME="field=EmailAddress" TYPE="text" SIZE="30">
How did you find us?
<INPUT TYPE="radio" VALUE="Direct" NAME="field=HowFound"></H3>
<INPUT TYPE="radio" VALUE="Link" NAME="field=HowFound"></H3>
<INPUT TYPE="radio" VALUE="Friend" NAME="field=HowFound"></H3>
<INPUT TYPE="radio" VALUE="BannerAd" NAME="field=HowFound"></H3>
</FORM>
The return.html page contains the mgiDatabaseSubmit tag:
<mgiDatabaseSubmit databaseFileLocation="Contact"
tableName="WebCustomers">
The mgiDatabaseSubmit tag in this example would add records
to the "WebCustomers" table in the "Contact"
database file.
Suggested Usage
|