MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual page 124

Table of Contents

Advertisement

104
3
4
5
Reviewing the code
The following table describes the code and its function:
Code
<cfif not isdefined("Form.Contract")>
</cfif>
<cfinsert datasource="CompanyInfo"
<cfoutput>You have added
</cfoutput>
Note
If you use form variables in
validates any form data it sends to numeric, date, or time data database columns.
You can use the hidden field validation functions for these fields to display a custom
error message.
</cfoutput>
</body>
</html>
Save the page as insertaction.cfm.
View insertform.cfm in a browser, enter values, and click the Submit button.
The data is inserted into the Employee table and the message displays.
<cfset Form.contract = "No">
tablename="Employee">
#Form.FirstName# #Form.Lastname#
to the employees database.
Description
If the user clears the Contractor check
box, no value gets passed to the action
page. The database field must have a
value, so check the Form.contract
variable and set it to No if it is not
defined.
Create a new row in the Employee table
of the CompanyInfo database. Insert
data from the form into database fields
with the same names as the form fields.
Inform the user that the data was
inserted into the database.
or
cfinsert
cfupdate
Chapter 7 Updating Your Database
tags, ColdFusion automatically

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents