Processing Form Input - Exercise

Contact Us or call 1-877-932-8228
Processing Form Input - Exercise

Processing Form Input

Duration: 15 to 25 minutes.

Next we will create a page that processes the form data. Our form entry page, excalculator- simpleform1.html, is already complete and is identical to democalculator- simpleform1.html above. Filled out, it would look like this:

  1. Our form entry page, Basics/Exercises/Calculator.html, is already complete and is identical to Basics/Demos/Calculator.html above. Filled out, it would look like this:
  2. In this exercise, we will create a page that simply outputs the form entries as a list.
  3. Open Basics/Exercises/ProcessCalculator.cfm in your editor.
  4. Output the form variables as list items using <cfoutput>.
  5. Save your work and test your solution in the browser by navigating to Basics/Exercises/Calculator.html and submitting the form.

Code Sample:

Basics/Exercises/ProcessCalculator.cfm
<html>
<head>
	<title>Calculator Entries</title>
</head>
<body>
<h1>Calculator Entries</h1>

You have entered:
<ul>
<!---
	Add list items that display your name,
	your friend's name, your speed,
	your friend's speed, and the units.
--->
</ul>

</body>
</html>

Solution:

Basics/Solutions/ProcessCalculator.cfm
<html>
<head>
	<title>Calculator Entries</title>
</head>
<body>
<h1>Calculator Entries</h1>
<cfoutput>
You have entered:
	<ul>
		<li><b>Your name:</b>  #FORM.yourname#</li>
		<li><b>Your speed:</b> #FORM.yourspeed#</li>
		<li><b>Your friend's name:</b> #FORM.friendname#</li>
		<li><b>Your friend's speed:</b> #FORM.friendspeed#</li>
		<li><b>Units:</b> #FORM.units#</li>
	</ul>
</cfoutput>
</body>
</html>
Next