Processing Form Data - MACROMEDIA COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION MX Getting Started

Building coldfusion mx applications
Table of Contents

Advertisement

Using the cfelseif tag to evaluate multiple expressions
To evaluate multiple expressions in a
your statement; for example:
<cfif expression 1>
HTML and CFML tags executed if expression 1 is True.
<cfelseif expression 2>
HTML and CFML tags executed if expression 2 is True.
<cfelse>
HTML and CFML tags executed for expression(s) that is False.
</cfif>
The following example shows you how you can evaluate multiple expressions using these tags.
This example uses a form in which users can enter their state to determine their state tax:
<cfoutput>
<cfif form.state IS "MA">
#form.state# State Tax: 8.5%
<cfelseif form.state IS "VA">
#form.state# State Tax: 8.2%
<cfelse>
#form.state# State Tax Unknown
</cfif>
</cfoutput>
The output of this
in the state form field, the state tax results returned is 8.5%. If the user enters VA in the state form
field, the state tax results returned is 8.2%. If the user enters any other state in the state form field,
State Tax Unknown is returned.

Processing form data

Virtually all web applications that gather and write information to a database use a form to
accomplish that task. Forms let you collect information from a user (using an order form,
registration form, and so on) and write that information to a database. Like HTML, there are two
independent steps for creating a form in ColdFusion:
Creating the layout for the form itself.
1.
Writing the code to process the submitted information.
2.
Every form that you create in ColdFusion consist of two parts: the form page and the action page.
These two pages work together to process user input. The form page contains the user interface
elements, such as input fields and radio buttons. The action page handles the processing of the
form page data.
28
Chapter 2: CFML Basics
cfif
statement is based on the value entered by the user. If the user enters MA
cfif
statement, you can use
and
cfelseif
cfelse
tags in

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents