![MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Скачать руководство пользователя страница 87](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-developing-web/coldfusion-4-5-developing-web_develop-manual_3286369087.webp)
Chapter 6: Updating Your Data
61
</HTML>
3.
Save the file as
insertform.cfm
in the
myapps
directory.
4.
View
insertform.cfm
in a browser.
Data Entry Form Notes and Considerations
Creating data entry fields for an HTML form is very simple:
•
You need only create the HTML form fields for each database field into which
you want to insert data.
•
The names of your form fields must be identical to the names of your database
fields.
•
You can use the full range of HTML input controls, including list boxes, radio
buttons, checkboxes, and multi-line text boxes in your forms.
•
ColdFusion uses the NAME attribute to map HTML form fields to the
corresponding database fields and inserts the data entered by the user into the
appropriate database fields.
Creating an Action Page to Insert Data
There are two ways to create an action page to insert data into a database.
The CFINSERT tag is the easiest way to handle simple inserts from either a CFFORM or
an HTML form.
For more complex inserts from a form submittal you can use a SQL INSERT statement
in a CFQUERY tag instead of a CFINSERT tag. The SQL INSERT statement is more
flexible because you can insert information selectively or use functions within the
statement.
To create an insert action page with CFINSERT:
1.
Create a new application page in Studio.
2.
Enter the following code:
4
<CFINSERT DATASOURCE="CompanyInfo" TABLENAME="Employees">
<HTML>
<HEAD>
<TITLE>Input Form</TITLE>
</HEAD>
<BODY>
<H1>Employee Added</H1>
<CFOUTPUT>
You have added #Form.FirstName# #Form.LastName# to the Employees
database.
</CFOUTPUT>
</BODY>
</HTML>
Содержание COLDFUSION 4.5-DEVELOPING WEB
Страница 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Страница 14: ...xiv Developing Web Applications with ColdFusion...
Страница 26: ...xxvi Developing Web Applications with ColdFusion...
Страница 34: ...8 Developing Web Applications with ColdFusion...
Страница 70: ...44 Developing Web Applications with ColdFusion...
Страница 84: ...58 Developing Web Applications with ColdFusion...
Страница 114: ...88 Developing Web Applications with ColdFusion...
Страница 148: ...122 Developing Web Applications with ColdFusion...
Страница 174: ...148 Developing Web Applications with ColdFusion...
Страница 208: ...182 Developing Web Applications with ColdFusion...
Страница 244: ...218 Developing Web Applications with ColdFusion...
Страница 274: ...248 Developing Web Applications with ColdFusion...
Страница 288: ...262 Developing Web Applications with ColdFusion...
Страница 300: ...274 Developing Web Applications with ColdFusion...
Страница 350: ...324 Developing Web Applications with ColdFusion...
Страница 362: ...336 Developing Web Applications with ColdFusion...