MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual page 127

Table of Contents

Advertisement

Updating Data
To create an update form:
1
2
3
4
Create a new page in ColdFusion Studio.
Edit the page so that it appears as follows:
<cfquery name="GetRecordtoUpdate"
datasource="CompanyInfo">
SELECT *
FROM Employee
WHERE Emp_ID = #URL.Emp_ID#
</cfquery>
<html>
<head>
<title>Update Form</title>
</head>
<body>
<cfoutput query="GetRecordtoUpdate">
<form action="updateaction.cfm" method="Post">
<input type="Hidden" name="Emp_ID"
value="#Emp_ID#"><br>
First Name:
<input type="text" name="FirstName" value="#FirstName#"><br>
Last Name:
<input type="text" name="LastName" value="#LastName#"><br>
Department Number:
<input type="text" name="Dept_ID" value="#Dept_ID#"><br>
Start Date:
<input type="text" name="StartDate" value="#StartDate#"><br>
Salary:
<input type="text" name="Salary" value="#Salary#"><br>
Contractor:
<cfif #Contract# IS "Yes">
<input type="checkbox" name="Contract" checked>Yes<br>
<cfelse>
<input type="checkbox" name="Contract">Yes<br>
</cfif>
<br>
<input type="Submit" value="Update Information">
</form>
</cfoutput>
</body>
</html>
Save the page as updateform.cfm.
View updateform.cfm in a browser by specifying the page URL and an Employee
ID, for example, http://localhost/myapps/updateform.cfm?Emp_ID=3.
107

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents