MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual page 118

Table of Contents

Advertisement

98
Creating the action page
After you create the input form, you can create the action page to process the user's
request. This action page determines where the user entered search criteria and
searches based only on those criteria.
To create the action page:
1
2
Create a new application page in ColdFusion Studio.
Enter the following code:
<html>
<head>
<title>Get Employee Data</title>
</head>
<body>
<cfquery name="GetEmployees" datasource="CompanyInfo">
SELECT *
FROM Employee
WHERE
<cfif #form.firstname# is not "">
Employee.FirstName LIKE '#form.FirstName#%' AND
</cfif>
<cfif #form.lastname# is not "">
Employee.LastName LIKE '#form.LastName#%' AND
</cfif>
<cfif #form.salary# is not "">
Employee.Salary >= #form.Salary# AND
</cfif>
<cfif isdefined("Form.Contract")>
Employee.Contract = 'Yes' AND
<cfelse>
Employee.Contract = 'No' AND
</cfif>
0=0
</cfquery>
<h3>Employee Data Based on Criteria from Form</h3>
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Salary</th>
<th>Contractor</th>
</tr>
<cfoutput query="GetEmployees">
<tr>
Chapter 6 Making Variables Dynamic

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Coldfusion 5

Table of Contents