Use input fields in a loop to update existing values in a database
Cannot use the data entry field on the page (this must be so basic, but I cannot get it to work)
In the extract below NEWVALUE field is not recognised
Process :
The user selects a case and is taken to another page that displays a list of entries linked to a case (so the number varies each time).
They complete an input field to update one or more the entry values.
They then press the submit button and the page refreshes with the new values.
extract :
<cfquery name="table1"...> SELECT ...</cfquery>
<cfoutput>
<input type="submit">
<cfform action="page2.cfm" method="POST" name="FormX">
<table width="200" border="1" cellspacing="0" cellpadding="2">
<cfloop query="table1">
<tr>
<td nowrap="nowrap">#field#</td> .... <!--- display fields --->
<td>New value</td><td><cfinput type="text" name="NEWVALUE" maxlength="20" size="20"></td> <!--- new value field--->
<cfif NEWVALUE is not ''> <!--- does not recognise the field NEWVALUE --->
<cfquery > UPDATE table1 .. SET field1 = NEWVALUE </cfquery> <!--- update value ---> </cfquery>
</cfif>
</tr>
</cfloop>
</table>
</cfform>
</cfoutput>
