title: How to concat two strings and use the result as a variable name in coldfusion?
body: <p>I have a form which has many fields in the format of </p>
  
  <ul>
  <li>name="field-1" </li>
  <li>name="field-2" </li>
  <li>name="field-3" </li>
  <li>name="field-4"</li>
  <li>etc....</li>
  </ul>
  
  <p>On the form action page, I would like to be able to use a loop and be able to use the index of the loop to concat with a string prefix like this <code>&lt;cfset newField = "field-" &amp; #index#&gt;</code> and then use the <code>#Variables.newField#</code> to access the form field on the previous page. </p>
  
  <p>I've been playing around with the <code>Evaluate()</code> function, but no luck.  I don't use ColdFusion much, so I may just be a little off on the syntax.  </p>
  
  <p>An example of how I am using it is:</p>
  
  <pre><code>&lt;cfset newField = "form.field-" &amp; #index#&gt;
  &lt;input type="hidden" 
        name="field-&lt;cfoutput&gt;#index#&lt;/cfoutput&gt;" 
        value="&lt;cfoutput&gt;Evaluate(Variables.newField)&lt;/cfoutput&gt;"&gt;
  </code></pre>