MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual page 80

Developing web applications with coldfusion
Table of Contents

Advertisement

54
<CFQUERY NAME=" queryname "
DATASOURCE=" datasourcename " >
... Base SQL statement
<CFIF value operator value >
... additional SQL
</CFIF>
</CFQUERY>
First, you need to create an input form, which asks for information about several fields
in the Employees table. Instead of entering information in each field, a user may want
to search on certain fields, or even on only one field. To search for data based on only
the fields the user enters in the form, you use CFIF statements in the SQL statement.
To create the input form:
1.
Create a new application page in Studio.
2.
Enter the following code:
<HTML>
<HEAD>
<TITLE>Input form</TITLE>
</HEAD>
<BODY>
<!--- Query the Employees table to be able to populate the form --->
<CFQUERY NAME="AskEmployees" DATASOURCE="CompanyInfo">
SELECT
FROM
</CFQUERY>
<!--- define the action page in the form tag. The form variables will
pass to this page when the form is submitted --->
<FORM ACTION="getemp.cfm" METHOD="post">
<!-- text box -->
<P>
First Name: <INPUT TYPE="Text" NAME="FirstName" SIZE="20"
MAXLENGTH="35"><BR>
Last Name: <INPUT TYPE="Text" NAME="LastName" SIZE="20"
MAXLENGTH="35"><BR>
Salary: <INPUT TYPE="Text" NAME="Salary" SIZE="10" MAXLENGTH="10">
</P>
<!-- check box -->
<P>
Contractor? <input type="checkbox" name="Contract" value="Yes" >Yes
if checked
</P>
FirstName,
LastName,
Salary,
Contract
Employees
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents