create a list using checkboxes, count the elements, do math
Hello, everyone. I'm a total coldfusion noob and I'm in over my head on a project. I've been trying to figure it out for the past 24 hours to no avail.
I'm trying to create a pizza order form for a project. I want to select the toppings on one page, then display the results in another page and do some math (the price of the pizza and the number of toppings, on the second page). I've got the first page down, I believe. I cannot figure out how to count the number of pizza toppings that I wind up choosing, and how to compute a price for the pizza once I've selected the ingredients.
Here's what I have thus far:
Input page:
<body>
<form action="ex2output.cfm" method="post">
Choose the ingredients you would like on your pizza:
<br />
Black Olives: $.50
<input type="checkbox" name="BlackOlives" value="Yes"/>
<br />
Hot Peppers: $1.00
<input type="checkbox" name="HotPeppers" value="Yes"/>
<br />
Mushrooms $.50
<input type="checkbox" name="Mushrooms" value="Yes"/>
<br />
Onions $.50
<input type="checkbox" name="Onions" value="Yes"/>
</br>
<input type="submit" value="Submit"/>
</body>
</html>
Output page:
<body>
<cfparam name="BlackOlives" default="no">
<cfset BlackOlives=".50">
<cfparam name="HotPeppers" default="no">
<cfset HotPeppers="1">
<cfparam name="Mushrooms" default="no">
<cfset Mushrooms=".50">
<cfparam name="Onions" default="no">
<cfset Onions=".50">
<cfoutput>
Your order:
<li>
<cfif BlackOlives is "yes"> Black Olives
</cfif>
</li>
<li>
<cfif HotPeppers is "yes"> Hot Peppers
</cfif>
</li>
<li>
<cfif Mushrooms is "yes"> Mushrooms
</cfif>
</li>
<li>
<cfif Onions is "yes"> Onions
</cfif>
</li>
</cfoutput>
</ul>
</body>
</html>
Any and all help would be greatly appreciated,
Thank you,
R
