User Guide
98 Chapter 6 Making Variables Dynamic
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 Create a new application page in ColdFusion Studio.
2 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>