Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identifying the recordset 1

Status
Not open for further replies.

neomorpheus

Programmer
Mar 9, 2001
47
US
I have a query which outputs the following

NAME AGE DATEOFBIRTH ADDRESS

John 33 12/21/66 123 John Lane
Joe 32 11/21/44 566 John Lane
Jack 23 07/17/55 8654 John Lane

At the end of each row, I have a modify button which submits the page. When I click on the modify button, I am unable to ascertain which recordset I wanted to modify. How can I go about doing that??

Please help

--------------------------------------------------------
<cfoutput>
<cfloop query = &quot;qMyCustRecords&quot;>
<tr bgcolor=&quot;#bgcolor#&quot;>

<td><div align=&quot;center&quot;>#Name#</div></td>
<td><div align=&quot;center&quot;>#Age#</div></td>
<td><div align=&quot;center&quot;>#DOB#</div></td>
<td><div align=&quot;center&quot;>#Address#</div></td>

<td><div align=&quot;center&quot;><input type=submit name=&quot;Modify&quot; value=&quot;Change&quot; class=button style=width:75></div></td>

</tr>
</cfloop>
</cfoutput>
 
There are a couple ways to do it.

The easiest is to make each row a different form.

Code:
<cfoutput query=&quot;qMyCustRecords&quot;>
<form action=&quot;somepage.cfm&quot; method=&quot;POST&quot;>
<tr bgcolor=&quot;#bgcolor#&quot;>

<td><div align=&quot;center&quot;>#Name#</div></td>
<td><div align=&quot;center&quot;>#Age#</div></td>
<td><div align=&quot;center&quot;>#DOB#</div></td>
<td><div align=&quot;center&quot;>#Address#</div></td>

<td><div align=&quot;center&quot;><input type=&quot;hidden&quot; name=&quot;recordNum&quot; value=&quot;#id#&quot;><input type=submit name=&quot;Modify&quot; value=&quot;Change&quot; class=button style=width:75></div></td>
</tr> 
</form>
</cfoutput>

where #id# is the primary key (or some unique identifier) of the row.

Then, in somepage.cfm, you now know, by checking #FORM.recordNum#, what record the values relate to.

Hope it helps,
-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top