• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 980
  • Last Modified:

Variable and Text Concatenate Coldfusion

Need help with grabbing data and passing it to the next page.
I have the following code:

<div><input type="Checkbox" name="fruit" value="apple" > Apple</div>
<div>Price of Fruit:<input type="Text" name="apple_type" size="8">&nbsp;&nbsp</div>
<div><input type="Checkbox" name="fruit" value="orange" > Orange</div>
<div>Price of Fruit:<input type="Text" name="orange_type" size="8></div>
<div><input type="Checkbox" name="fruit" value="banana" > Orange</div>
<div>price of Fruit:<input type="Text" name="banana_type" size="8></div>

For instance, if the user check checkkbox 1 [for apple] and enter 12.50 on the input box, and then put a check mark on Checkbox 3 [for banana] and enter 10.00 on the input box.

I can display easily the Apple and Banana values from <div> one by using the  loop below.  How can I display the associated price text boxes ?

<cfloop list="#fruit#" index="curItem">
    <cfoutput> #curItem#_type <cfoutput>  <------  I know this code is wrong.  I need help on this part.

How can I display the associated price text boxes ?

1 Solution
<cfoutput>#form[curItem & "_type"]#</cfoutput>

And you can wrap it in the DollarFormat function if you wish.
jramos74Author Commented:
Thanks, mkshline.  I got the formating part.n =)

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now