MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 444

Developing coldfusion mx applications
Table of Contents

Advertisement

<cfelse>
<input type="checkbox" name="Contract">Yes
</cfif></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="Submit" value="Update Information"></td>
</tr>
</form>
</table>
</cfoutput>
</body>
</html>
Save the file as update_form.cfm.
2
View update_form.cfm in your web browser by specifying the page URL and an Employee ID;
3
for example, enter the following:
http://localhost/myapps/update_form.cfm?Emp_ID=3
Note: Although you can view an employee's information, you must code an action page before
you can update the database. For more information, see
on page
445.
Reviewing the code
The following table describes the code and its function:
Code
<cfquery name="GetRecordtoUpdate"
datasource="CompanyInfo">
SELECT * FROM Employee
WHERE Emp_ID = #URL.Emp_ID#
</cfquery>
<cfoutput query="GetRecordtoUpdate">
...
</cfoutput>
<form action="update_action.cfm" method="Post">
...
</form>
<input type="Hidden" name="Emp_ID"
value="#Emp_ID#"><br>
444
Chapter 21: Updating Your Database
"Creating an action page to update data"
Description
Queries the CompanyInfo data source
and returns records in which the
employee ID matches what was entered
in the URL that called this page.
Makes available as variables the results
of the GetRecordtoUpdate query in the
form created in subsequent lines.
Creates a form whose variables will be
processed on the update_action.cfm
action page.
Uses a hidden input field to pass the
Emp_ID (primary key) value to the action
page.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents