954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Simple starter cf45 application

0
By William Pullen on Dec 24th, 2004 9:32 am

this application shows you how to declare variables and display variables. the end result of this code is showing you the total price after tax. this is mainly for beginners.

<cfset nTax = .05 />
<cfset nPrice = 5.95 />
<cfset nTotal = nTax * nPrice + nPrice />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Variables</title>
</head>

<body>
<cfoutput>Price: #nPrice#</cfoutput><br>
<cfoutput>Tax: #nTax#</cfoutput><br>
<cfoutput>Total: #nTotal#</cfoutput>


</body>
</html>

Wouldn't you want to say

<cfparam name="nTax" default=".05"><cfparam name="nPrice" default="5.95">


instead? Also, I'd wrap the tags only around the variables

Price: <cfoutput>#dollarformat(nPrice)#</cfoutput>


(also put the dollar numbers in dollar format on all of them. :)

jsmall26
Light Poster
36 posts since Jan 2008
Reputation Points: 10
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You